About Features Downloads Getting Started Documentation Events Support GitHub

Site Tools


Language Support

This page refers to VuFind 2.x and later; use of earlier versions is no longer recommended.

Keywords: localization, l10n, internationalization, i18n

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

Translate Function

VuFind uses Laminas' translation mechanism. The translator object is registered in the service manager under the standard 'Laminas\Mvc\I18n\Translator' key.


  • 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.
  • Starting with VuFind 2.4, a convenient TranslatorAwareTrait has been added which adds VuFind's standard translation capabilities to any object. Use it in combination with the TranslatorAwareInterface to have the translator object automatically injected.

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.
  • Make sure the file is sorted in a case-insensitive manner; VuFind's test suite will complain if language files are out of order, though it will not prevent translations from working properly in the user interface. A command-line tool exists to perform this sorting for you (see below).
  • 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.

:!: 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.

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/index.php language normalize [path_to_language_files]

VuFind will automatically sort the files for you.

Adding a New Language

  1. Create a new language file as described above and put it in the languages directory (either in the root of VuFind if you are planning to commit the new language to the dev branch, or inside your local settings directory if this is a local customization).
  2. 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.
  3. If desired, translate help screens as described above.
  4. Edit config.ini and add your new language to the [Languages] section.

Customizing Language Files

If you need to customize the language files residing in VUFIND_HOME/languages but do not want to commit this customization to the dev branch, you only need to create a languages folder in your local folder (or any folder that is configured as your VUFIND_LOCAL_DIR). Any language file in your VUFIND_LOCAL_DIR/languages folder will be merged with its corresponding language file in VUFIND_HOME/languages (implicit inheritance).

Starting with VuFind 2.5, you can also put a languages directory inside a 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.

Defining an Explicit Parent Language File

In addition to the above mentioned implicit inheritance of language .ini files VuFind\Il8n\Translator offers a similiar feature as the configuration .ini file's [Parent_Config] section: by adding the line @parent_ini = “relative/path/to/language.ini” to your custom language file in VUFIND_LOCAL_DIR/languages you can reference any other language .ini file as being the parent .ini file.

Example 1
  • language is set to “de”
  • VUFIND_LOCAL_DIR = /var/www/vufind2/local
  • vufind2/customlangfiles/custom.ini
foo = bar
  • VUFIND_LOCAL_DIR/languages/de.ini
@parent_ini = "../../customlang/custom.ini"

The content of vufind2/customlangfiles/custom.ini will be merged into VUFIND_LOCAL_DIR/languages/de.ini and the result is being merged with vufind2/languages/de.ini.

Example 2

Using customized language files for a multisite-setup.

  • all your customized language files which should be used by all multisites go into:
  • your multisite local_dirs:
  • let every multisite use the customized language files:
      @parent_ini = "../../local/languages/de.ini"
      @parent_ini = "../../local/languages/en.ini"
      @parent_ini = "../../local/languages/de.ini"
      @parent_ini = "../../local/languages/en.ini"

You can even use @parent_ini for multiple inheritance steps, BUT the @parent_ini path always needs to be relative to VUFIND_LOCAL_DIR.

Text Domains

Starting with VuFind 2.5, VuFind supports text domains – essentially namespaces for language strings. You can create a subdirectory of the languages folder named for the text domain and containing language .ini files named for the appropriate language codes. The text domain is then accessed in the translator by prefixing the string with the text domain and a '::' separator.

For example, suppose you added:


  myString = "The translation"

Then calling



  $translator->translate(['MyDomain', 'myString']);

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 these)
  • 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

VuFind's help screens contain too much text for the standard translation mechanism to be a practical way of presenting them in multiple languages. Instead, under the theme/root/templates/HelpTranslations 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.


This topic is discussed in the Internationalization video.

development/architecture/localization.txt · Last modified: 2021/11/09 11:34 by demiankatz