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 [2015/12/11 19:35] – [Language Support] demiankatz | development:architecture:localization [2022/08/02 15:18] – 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 ==== | ||
Line 22: | Line 22: | ||
* Save the file in UTF-8 format without a Byte Order Marker (BOM). | * Save the file in UTF-8 format without a Byte Order Marker (BOM). | ||
- | * Sort the file after adding new lines. | + | * Make sure the file is sorted in a case-insensitive manner; VuFind' |
* 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 === | ||
+ | |||
+ | To sort a directory full of language files, simply go to the command line, and from your $VUFIND_HOME directory, run: | ||
+ | |||
+ | php public/ | ||
+ | | ||
+ | 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 desired, translate help screens as described [[#help screen translation|above]]. | - If desired, translate help screens as described [[#help screen translation|above]]. | ||
- | - Edit [[: | + | - Edit [[configuration: |
+ | |||
+ | ==== Updating a Language ==== | ||
+ | |||
+ | 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: | ||
+ | Note also that there are [[administration: | ||
==== Customizing Language Files ==== | ==== Customizing Language Files ==== | ||
- | If you need to customize the language files residing in VUFIND_HOME/ | + | 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 [[vufind2:customizing_the_user_interface|theme]] folder to apply custom translations to that specific theme. This can be useful, for example, to use shorter strings in a mobile interface than a desktop version. | + | Starting with VuFind 2.5, you can also put a languages directory inside a [[development:architecture: |
=== Defining an Explicit Parent Language File === | === Defining an Explicit Parent Language File === | ||
Line 107: | 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 ===== | ||
VuFind' | VuFind' | ||
+ | ===== 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