Gettext » History » Version 15

« Previous - Version 15/19 (diff) - Next » - Current version
moyo, 06/13/2012 11:10 PM

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 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 :)