Warning: This page has not been updated in over over a year and may be outdated or deprecated.
development:architecture:localization
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
development:architecture:localization [2016/05/31 19:06] – [Adding a New Language] demiankatz | development:architecture:localization [2023/08/17 20:08] – demiankatz | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Language Support ====== | ====== Language Support ====== | ||
- | // This page refers to VuFind 2.x and later; | + | // This page refers to VuFind 2.x and later; |
Keywords: localization, | Keywords: localization, | ||
Line 9: | Line 9: | ||
===== Translate Function ===== | ===== Translate Function ===== | ||
- | VuFind uses Zend Framework's translation mechanism. | + | VuFind uses Laminas' translation mechanism. |
Notes: | Notes: | ||
Line 15: | Line 15: | ||
* If you attempt to translate a string that is not found in a language map, the original string will be displayed untranslated. | * If you attempt to translate a string that is not found in a language map, the original string will be displayed untranslated. | ||
* Many of the translated strings in the language files are simply chunks of English text. However, more recent additions are represented as shorter tokens (i.e. " | * Many of the translated strings in the language files are simply chunks of English text. However, more recent additions are represented as shorter tokens (i.e. " | ||
- | * Starting with VuFind 2.4, a convenient [[https:// | + | * Starting with VuFind 2.4, a convenient [[https:// |
- | ==== Formatting Language Files ==== | + | ===== Formatting Language Files ===== |
When modifying an existing language file or creating a new one, you should observe these standards: | When modifying an existing language file or creating a new one, you should observe these standards: | ||
Line 25: | Line 25: | ||
* Put double-quotes around multi-word phrases on the right side of the equals sign. Do NOT put quotes around phrases on the left side of the equals sign. | * Put double-quotes around multi-word phrases on the right side of the equals sign. Do NOT put quotes around phrases on the left side of the equals sign. | ||
- | For an example of a full language file, see [[https:// | + | For an example of a full language file, see [[https:// |
- | Note: If modifications to a language file do not take effect, sometimes it is necessary to clear out the local directory language cache by removing the local/ | + | :!: Note: If modifications to a language file do not take effect, sometimes it is necessary to clear out the local directory language cache by removing the local/ |
- | === Sorting Language Files === | + | ==== Sorting Language Files ==== |
To sort a directory full of language files, simply go to the command line, and from your $VUFIND_HOME directory, run: | To sort a directory full of language files, simply go to the command line, and from your $VUFIND_HOME directory, run: | ||
Line 36: | Line 36: | ||
| | ||
VuFind will automatically sort the files for you. | VuFind will automatically sort the files for you. | ||
- | ==== Adding a New Language ==== | + | ===== Adding a New Language |
- | - Create a new language file as described [[# | + | - Create a new language file as described [[# |
- If you also wish to translate strings inside text domains (see below) you will need to create appropriate subdirectories inside languages, and put additional language files inside these directories. | - If you also wish to translate strings inside text domains (see below) you will need to create appropriate subdirectories inside languages, and put additional language files inside these directories. | ||
- If desired, translate help screens as described [[#help screen translation|above]]. | - If desired, translate help screens as described [[#help screen translation|above]]. | ||
- Edit [[configuration: | - Edit [[configuration: | ||
+ | ===== Updating a Language ===== | ||
- | ==== Customizing | + | If you wish to maintain an existing set of language files, but you are not sure which strings have been recently added, VuFind includes a language tool which will generate lists of missing strings in all supported languages. To access it, turn on [[development: |
- | If you need to customize the language files residing in VUFIND_HOME/ | + | Note also that there are [[administration: |
+ | |||
+ | ===== Customizing Language Files ===== | ||
+ | |||
+ | If you need to customize the language files residing in VUFIND_HOME/ | ||
Starting with VuFind 2.5, you can also put a languages directory inside a [[development: | Starting with VuFind 2.5, you can also put a languages directory inside a [[development: | ||
- | === Defining an Explicit Parent Language File === | + | ==== Defining an Explicit Parent Language File ==== |
In addition to the above mentioned implicit inheritance of language .ini files VuFind\Il8n\Translator offers a similiar feature as the configuration .ini file's [Parent_Config] section: by adding the line @parent_ini = " | In addition to the above mentioned implicit inheritance of language .ini files VuFind\Il8n\Translator offers a similiar feature as the configuration .ini file's [Parent_Config] section: by adding the line @parent_ini = " | ||
- | == Example 1 == | + | === Example 1 === |
* language is set to " | * language is set to " | ||
Line 64: | Line 69: | ||
The content of vufind2/ | The content of vufind2/ | ||
- | == Example 2 == | + | === Example 2 === |
Using customized language files for a multisite-setup. | Using customized language files for a multisite-setup. | ||
Line 102: | Line 107: | ||
- | ==== Text Domains ==== | + | ===== Text Domains |
Starting with VuFind 2.5, VuFind supports text domains -- essentially namespaces for language strings. You can create a subdirectory of the languages folder named for the text domain and containing language .ini files named for the appropriate language codes. The text domain is then accessed in the translator by prefixing the string with the text domain and a '::' | Starting with VuFind 2.5, VuFind supports text domains -- essentially namespaces for language strings. You can create a subdirectory of the languages folder named for the text domain and containing language .ini files named for the appropriate language codes. The text domain is then accessed in the translator by prefixing the string with the text domain and a '::' | ||
Line 115: | Line 120: | ||
$translator-> | $translator-> | ||
+ | |||
+ | or | ||
+ | |||
+ | $translator-> | ||
on a valid $translator object would return "The translation" | on a valid $translator object would return "The translation" | ||
+ | |||
+ | Text domains currently used by VuFind: | ||
+ | |||
+ | * CallNumberFirst - used for translation of main classification category | ||
+ | * CreatorRoles - used for translating author relator terms (such as [[https:// | ||
+ | * HoldingStatus - used for displaying complex item availability messages (not supported by all ILS drivers) | ||
+ | * Exception - used for exception messages (currently not the exclusive location for these kinds of messages, but refactoring may eventually occur) | ||
===== Help Screen Translation ===== | ===== Help Screen Translation ===== | ||
Line 122: | Line 138: | ||
VuFind' | VuFind' | ||
+ | ===== Troubleshooting Language Strings ===== | ||
+ | |||
+ | Starting with VuFind 9.1, if you activate the " | ||
+ | |||
+ | ===== Video ===== | ||
+ | |||
+ | This topic is discussed in the [[videos: | ||
---- struct data ---- | ---- struct data ---- | ||
+ | properties.Page Owner : | ||
---- | ---- | ||
development/architecture/localization.txt · Last modified: 2024/01/10 13:56 by demiankatz