About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


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.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
development:architecture:localization [2023/09/21 13:54] – [Updating a Language] demiankatzdevelopment:architecture:localization [2024/01/10 13:55] – [Translate Function] demiankatz
Line 12: Line 12:
  
   * 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. "adv_search_filters").  The token approach is often preferable since it allows for more concise map files and reduces the chances of conflicts where the same text has multiple meanings.+  * Many of the translated strings in the language files are simply chunks of English text.  However, more recent additions are represented as shorter abstract keys (i.e. "adv_search_filters").  The abstract key approach is often preferable since it allows for more concise map files and reduces the chances of conflicts where the same text has multiple meanings.
   * Starting with VuFind® 2.4, a convenient [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareTrait.php|TranslatorAwareTrait]] has been added which adds VuFind®'s standard translation capabilities to any object. Use it in combination with the [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareInterface.php|TranslatorAwareInterface]] to have the translator object automatically injected.   * Starting with VuFind® 2.4, a convenient [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareTrait.php|TranslatorAwareTrait]] has been added which adds VuFind®'s standard translation capabilities to any object. Use it in combination with the [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareInterface.php|TranslatorAwareInterface]] to have the translator object automatically injected.
 +  * The translate function can accept an array of values to insert into the translation string in order to include variables inside the translation (e.g. numbers). Starting with VuFind® 10.0, an additional argument can be added to the translate function to override the simple search-and-replace value insertion mechanism with the more complex ICU MessageFormatter syntax. See [[https://github.com/vufind-org/vufind/pull/3286|pull request #3286]] for details.
  
 ===== Formatting Language Files ===== ===== Formatting Language Files =====
development/architecture/localization.txt · Last modified: 2024/01/10 13:56 by demiankatz