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
development:architecture:localization [2024/01/10 13:56] – [Translate Function] demiankatzdevelopment:architecture:localization [2024/01/10 13:56] (current) – [Translate Function] demiankatz
Line 14: Line 14:
   * 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.   * 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). Placeholders for values are generally surrounded by double-percent-signs (e.g. %%token%%) in the language files. 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. When using MessageFormatter syntax, placeholders use braces instead of percent signs. See [[https://github.com/vufind-org/vufind/pull/3286|pull request #3286]] for details and examples.+  * 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). Placeholders for values are generally surrounded by double-percent-signs (e.g. <nowiki>%%token%%</nowiki>) in the language files. 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. When using MessageFormatter syntax, placeholders use braces instead of percent signs. See [[https://github.com/vufind-org/vufind/pull/3286|pull request #3286]] for details and examples.
  
 ===== Formatting Language Files ===== ===== Formatting Language Files =====
development/architecture/localization.txt · Last modified: 2024/01/10 13:56 by demiankatz