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 revision
Previous revision
Next revisionBoth sides next revision
development:architecture:localization [2019/06/19 12:46] – [Text Domains] demiankatzdevelopment:architecture:localization [2020/09/22 13:28] demiankatz
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. "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 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.
-  * Starting with VuFind 2.4, a convenient [[https://github.com/vufind-org/vufind/blob/master/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/master/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.
  
 ==== Formatting Language Files ==== ==== Formatting Language Files ====
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://github.com/vufind-org/vufind/blob/master/languages/en.ini|en.ini]].+For an example of a full language file, see [[https://github.com/vufind-org/vufind/blob/dev/languages/en.ini|en.ini]].
  
 :!: 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/cache/languages directory. The directory should be recreated automatically. :!: 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/cache/languages directory. The directory should be recreated automatically.
Line 115: Line 115:
  
     $translator->translate('MyDomain::myString');     $translator->translate('MyDomain::myString');
 +
 +or
 +
 +    $translator->translate(['MyDomain', 'myString']);
  
 on a valid $translator object would return "The translation". on a valid $translator object would return "The translation".
development/architecture/localization.txt · Last modified: 2024/01/10 13:56 by demiankatz