User Tools

Site Tools


en:user_advanced:gs3_search_field_display

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:user_advanced:gs3_search_field_display [2016/07/27 22:31] kjdonen:user_advanced:gs3_search_field_display [2018/12/10 01:23] (current) – removed kjdon
Line 1: Line 1:
-======Customising the field list display in Greenstone 3====== 
- 
-Note, main dictionaries are found in web/WEB-INF/classes, java source code is found in src/java/org/greenstone/gsdl3 
- 
-==== Levels==== 
- 
-<code><level name="section"/></code> 
- 
-This will be displayed using level.section from the ServiceRack.properties dictionary. 
- 
-<code> 
-<level name="section"> 
-  <dosplayItem name="name" lang="fr">Chaptires</displayItem> 
-  <displayItem name="name" lang="en">Chapters</displayItem> 
-  <displayItem name="name" key="level.chapter"/> 
-</level> 
-</code> 
- 
-For english, the lang=en displayItem will be used, as it matches the current lang. 
-For languages where there is not a specific displayItem, it will use one with a key (if present). This key (level.chapter) is looked up in the ServiceRack.properties dictionary (for the approprate language). If it can find a value, then this will be used. If no value is found, then the first displayItem will be used as a default (in this case, the french version). If for some reason, no displayItem values are found (eg if only a key type one is present and the key hasn't been defined), then it will default to using level.section from the ServiceRack dictionary. 
- 
-(See getDisplayText in service/ServiceRack.java, and getLevelData in service/AbstractGS2FieldSearch.java) 
- 
-==== Dictionary Customization ==== 
- 
-To get language specific strings in Java we use ResourceBundle dictionaries. If asked for a key from a specific dictionary in a specific language, Java will load the dictionary and look up the key. It has a chain or languages it tries. The specified language, a family related language (I think) , the default language. 
- 
-We use a custom classloader to find dictionary files (util/CollectionClassLoader.java). 
-If the code is looking for eg ServiceRack.properties, it will first look in the current collection's **resources** folder. Otherwise it will look in the main classes area which is web/WEB-INF/classes. 
-This enables a collection to customise the values without affecting other collections. 
- 
-getTextString() (in services/ServiceRack.java) is the method we use to look something up in a dictionary. 
- 
-In some cases, a dictionary name is passed in to getTextString() (e.g. metadata_names). In this case, we look for metadata_names dictionary using the CollectionClassLoader, and return the value from that dictionary. If no value is found, then we return nothing. 
- 
-In the majority of cases, we will try various named dictionaries to try and find the key. It starts with the current class name, then tries up the class hierarchy until it gets to ServiceRack (which is the base class for all ServiceRacks. Once it gets to looking in ServiceRack.properties, it will try a key lookup of servicename.key, then just key itself. 
- 
-In this way different services can override values. 
-For example, if GS2MGPPSearch is looking up the value for level.section, the following shows the order of precendence (dictionary_file:key_name) 
- 
-GS2MGPPSearch.properties: level.section 
-AbstractGS2FieldSearch.properties: level.section 
-AbstractGs2TextSearch.properties: level.section 
-ServiceRack.properties: GS2MGPPSearch.level.section 
-ServiceRack.properties: level.section 
  
en/user_advanced/gs3_search_field_display.1469658667.txt.gz · Last modified: 2016/07/27 22:31 by kjdon