Gettext » History » Version 17

« Previous - Version 17/19 (diff) - Next » - Current version
jmd, 10/08/2013 12:29 AM

Gettext / Translation

For translators

Since version 0.84, GLPI use gettext as localization. We use transifex for manage translations.
The project page is here :
You could register to transifex and request to join a translation team.
To discussed about translation also register to glpi-translation mailing-list :

Gettext solution permit to manage :
  • variable strings : strings may contains variable informations such as name or number. Example : "ID %s" to display ID 12. When several variables are used, they are ordered for manage RTL language. For example : "%1$s adds the item %2$s"
  • plural : various plural forms are used depending of the language. Gettext permit to have a clean management of them.
  • context : a string may have several meanings depending of the context. Gettext permit to have 2 translations for a same string when developer used context. In transifex, you could see context information in Details / Description
  • RTL : gettext will permit to have a clean management of RTL languages (arabic...). Now, the RTL management is not complete but strings with parameters may have a RTL translation. Example : "%1$s %2$s" may be translated to "%2$s %1$s" (invert informations)

Localisation scheme :

  • Developpers add new strings to GLPI source code using standard functions (__(), __s(), _n()...), managing plurals and context.
  • New strings are extract to a gettext template file (pot file) and send to transifex. New strings are proposed to translation.
  • Translations are extracted from transifex as po file and convert to binary mo file used by GLPI.

For users who want editing files

en_GB.po - this is a ASCII file (readable text). It's responsible of the text displayed on GLPI. This is the file that will be edited. - this is a binary file (machine readable). This is the file used by GLPI and is compiled from the .po file.

Step 1: Download a gettext catalogs editor

For example you could use Poedit. It's a free cross-platform gettext catalogs (.po files) editor.

Download Poedit and install

Step 2: Download your xx_XX.po file
To edit your xx_XX.po file, you must first download a copy of it to your computer.

Step 3: Run Poedit
Run Poedit and then click File and open xx_XX.po.

Step 4: Edit
To edit a string, within Pane 1, click on the string you wish to edit. You'll then see the string appear in Pane 2. You should not edit the string in Pane 2 . Instead, click on Pane 3 and type the text you'd like to appear instead.

You may continue to edit strings by repeating the above procedure. Once you're done editing, click File > Save.

By saving, the program will automatically create a new file called This file will appear in the same location on your computer as xx_XX.po.

Step 5: Upload to your GLPI installation
Lastly, you must now upload your updated file to the locales folder, replacing the 'old' file. You do NOT need to upload the .po file, but you may if you'd like. Only the .mo file is actually used by GLPI.

For developpers

  • Strings with troubles with solution:
    • Transfer the verb / Transfer the noun: Do not use the verb. Or add To Transfer
      • Remi : create a "button" context for all verb ?
      • MoYo : good idea when a solution for contexts will be founded
    • Software singular / Software plural: use _n('Software','Software',$nb)
  • String with troubles without solution (for the moment):
    • in search::showList() // Create title => generated string
    • Very High, High, Medium, Low, Very Low => various translation in french for genre (impact, priority, urgency). Proposal, use" impact/low" as msgid, "Low" as msgstr (english), with a comment for translation team
      • Moyo : Must be done with gettext context... But Zend do not permit using them.
      • Remi : Nor php
      • MoYo : but problem using PHP extension (server prerequisites = all locales installed). See internal mail.
    • "General" : $LANG['help'][30], $LANG['setup'][139], $LANG['setup'][703] (genre : Général/Générale)
  • Other TODO
    • in showSystemInformations, lang is forced to en_GB, so probably no need to use gettext there.
      • MoYo : Yesssss
      • Remi : done :)