About Features Downloads Getting Started Documentation Events Support

Site Tools


legacy:vufind_1.x_developer_manual:language_localization_support

Language / Localization Support

This page refers to VuFind 1.x; for newer documentation, see VuFind 2.x Language/Localization Support.

VuFind supports multiple languages in its user interface through two main mechanisms.

Translate Function

VuFind supports a global translate() function (available as {translate text='xxx'} tags within the Smarty templates) which will translate a string of text into the user's currently selected language by looking at the map files in the web/lang directory of the VuFind installation.

Notes:

  • If you attempt to translate a string that is not found in a language map, the original string will be displayed untranslated.
  • If you turn debug on in config.ini, a special marker will be shown around untranslated strings to help track down missing translations in the code.
  • 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.

Formatting Language Files

When modifying an existing language file or creating a new one, you should observe these standards:

  • Save the file in UTF-8 format without a Byte Order Marker (BOM). Including a BOM may cause VuFind to fail to parse the file correctly.
  • Sort the file after adding new lines. The TextTools add-on for jEdit does a good job of this.
  • 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 en.ini.

Help Screen Translation

Note: This feature applies to VuFind 1.0RC2 and later only.

VuFind's help screens contain too much text for the standard {translate} mechanism to be a practical way of presenting them in multiple languages. Instead, under the web/interface/themes/[your_theme]/Help directory, the help templates are in folders whose names correspond with VuFind language codes (i.e. “en” for English). When a user requests a help screen, VuFind attempts to serve them the most appropriate version for their selected language, though it defaults to the English version if nothing else is available; as of this writing, help screens have not been translated into all possible languages.

Adding a New Language

  1. Create a new language file as described above and put it in the web/lang directory.
  2. If desired, translate help screens as described above.
  3. Edit config.ini and add your new language to the [Languages] section.
legacy/vufind_1.x_developer_manual/language_localization_support.txt · Last modified: 2015/12/21 11:47 by demiankatz