en:user_advanced:gs2_format
Differences
This shows you the differences between two versions of the page.
| — | en:user_advanced:gs2_format [2023/03/13 01:46] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | |||
| + | |||
| + | |||
| + | ====== Advanced Greenstone 2 Formatting Topics ====== | ||
| + | |||
| + | ===== Displaying Language Names instead of Codes ===== | ||
| + | |||
| + | Often documents will have language metadata in two letter codes, such as en, fr, ja, or maybe three letter codes, like eng, fre, ger. | ||
| + | |||
| + | Lets say our documents have two letter language codes, in the dc.Language metadata field. And we want to display this in our search results. We can add // | ||
| + | |||
| + | If we want to display the name of the language instead of the code, we can use // | ||
| + | |||
| + | Internally, // | ||
| + | These macros are defined in languages.dm in the macros folder. | ||
| + | |||
| + | === Displaying language names in other languages === | ||
| + | Greenstone only provides English versions of the language names. You can add macro definitions for other languages into the languages.dm file by copying the rule and adding a language argument. For example: | ||
| + | |||
| + | // | ||
| + | _iso639en_ [l=es] {Inglés}// | ||
| + | |||
| + | === Using three letter codes === | ||
| + | |||
| + | Greenstone only provides a mapping for two letter codes. If you are using three letter codes, you can add in new mappings to the languages.dm file in a similar way. | ||
| + | |||
| + | Add for example: | ||
| + | |||
| + | // | ||
| + | _iso639fre_ {French}// | ||
| + | |||
| + | Alternatively, | ||
| + | |||
| + | === Language codes that are not in Language metadata === | ||
| + | |||
| + | This formatting trick in Greenstone only works for metadata elements called Language (or with a namespace, e.g. dc.Language). There is a hard coded test for ' | ||
| + | |||
| + | This applies too if you have built a classifier on Language metadata. When you are displaying the bookshelf of the classifier, the metadata you are outputting is no longer called // | ||
| + | |||
| + | When // | ||
| + | |||
| + | For all others, we output // | ||
| + | |||
| + | In the collection' | ||
| + | |||
| + | This example will turn [format: | ||
| + | |||
| + | //package format\\ | ||
| + | \\ | ||
| + | _Title_ {_iso639: | ||
| + | // | ||
| + | |||
| + | The //_1_// part represents the (first) argument passed in to the macro. | ||
