Revision [1820]

This is an old revision of HowToTranslate made by PhilDaintree on 2010-05-07 22:51:42.


webERP Translations

webERP can be translated to any language so that the entire web-interface is displayed in the language of any user. The system can display different languages for different users - all at the same time - depending on the setting of the language in the individual users' settings.

Following resolution of a long standing problem by Javier - producing PDF reports that were of acceptable size and at the same time using the utf-8 character set. (The solution was to make use of Adobe CIF fonts - this needs the user to use the adobe acrobat reader if using non-English pdfs) - translations all use utf-8 character sets. webERP is now completely utf-8 for all languages. This requires that the necessary utf-8 locales are installed on your web-sever.


1. Join the mailing list at:

Let the list know you're wanting to help with a translation - someone may already be working on it.

2. Obtain the latest messages.po file to edit manually. There are tools available to edit this file quite efficiently search google for poedit

The latest messages.pot file can be downloaded from:

The source code SVN repository

Edit the file provided entering the translations for the strings labelled msgid in the string labelled msgstr. Watch for html strings embedded inside the strings the html will also be required in the translated string. Please complete the translation file header information - with your details so that you are accorded proper recognition for your contribution.

A new folder under webERP/locale/ needs to be created with the locale abbreviation for your language - note that webERP requires utf-8 locales - some examples:

fr_FR.utf8 - French
en_US.utf8 - English US
de_DE.utf8 - German

say you are creating a German translation you need to create the folder


and the folder below this called LC_MESSAGES


The edited messages.po file needs to be saved under this folder.
With the new messages.po under webERP/locale/de_DE.utf8/LC_MESSAGES you need to run the gettext utility msgfmt that "compiles" the messages.po file into a file -from the command line:

# cd webERP/locale/de_DE.utf8/LC_MESSAGES
#msgfmt messages.po

Return the messages.po file containing your translations to

The translations can be selected in the main system by clicking on the user name - a list of the languages available will be shown with their locale abbreviations available for selection. Select your new language folder then click on the enter button. The interface should now appear with the translations you entered in your messages.po

An archive of the new language directory and instructions on how to use it will be emailed for your use and a distribution of the language pack set up on sourceforge by the project administrator.

Language codes must follow the standard format for locales, 2 lower case characters for the language and then an underscore then a further 2 characters in upper case representing the country - the utf-8 locale for the country normally has .utf8 appended eg:

en_GB.utf8 - english underscore Great Britain - using the utf-8 character set
en_US.utf8 - english underscore United States
en_AU.utf8 - english underscore Australia

For the translation to be used the locale code must be recognised by the machine (you can check the locales defined on a *nix machine by typing locale -a at the # prompt).

It is important not to enter the " character in any translations - since this is used by gettext to quote the strings.

It is recommended that translations start with the index.php module since this main menu is the most visible of all pages.

That's it! However, for the more curious and technically minded more detail is provided below on the mechanics of the gettext system.

Technical Overview

How is it Done

webERP uses the GNU gettext package for language translations. PHP must be compiled with gettext functions to enable multi-language translations. However, it will produce english if the PHP interpreter does not have the gettext functions compiled in to the server.

The gettext translation files are held in the locale directory, under this directory there are sub-directories for each locale, a two character code representing the language to be used. eg en for English, it for Italian etc. New directories will be made up on request if a translator wishes to have a local version for their language. Under the locale, two character abbreviation code directory there is a further sub-directory called LC_MESSAGES - this is where the translation files exist. There are two files in each of these directories:

1. messages.po this file contains all the strings to be translated. This is the only file of concern for translators
2. this is a binary machine searchable tranlation file used by gettext. The .mo file is produced by a gettext utility using the .po. The effort is needed to get the .po file translated - the .mo file is easily created by the project admin.

Any text editor can be used to edit the .po file (GNU Emacs contains specific functionality for editing .po files there is a special PO-Mode - there is also an editor called poedit which has some useful tools for administering gettext translations)

Understanding the messages.po File

The translation is performed by translating the strings in the messages.po file into the other language. It is important to work on the most recent messages.po file from the locale/en_GB.utf8/LC_MESSAGES/ directory in the SVN. This can be downloaded directly here.

The messages.po is made up of sections

eg. for a French translation file

#: AccountGroups.php:8 index.php:890
msgid "An example string in English that needs to be translated"
msgstr "Une corde d'exemple dans le ce anglais doit A?tre traduite "

the line #: AccountGroups.php:8 index.php:890

means that the string following is used in the AccountGroups.php script on line 8 and the index.php script on line 890. It could be useful to understand the context of where the script is used. Strings that are used several times throughout the application only need to be translated once. In some cases the #: line showing where the string is used can be quite an extensive list of scripts.

msgid "An example string in English that needs to be translated"

this line is the english string which is to be substituted by the text in msgstr. If the value of msgstr is empty - "". gettext will return the english string.

The effort of the translation is to edit the messages.po file and enter the language translation within the inverted commas of the msgstr.

The .po File Header

The .po file starts with some initial comments which should also be completed

"SOME DESCRIPTIVE TITLE", - should be replaced with webERP - LANGUAGE Translation File - where LANGUAGE is the language being translated into
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. - should be your name and email address - with the year of the work being done

Should be webERP - version number

This is the date of your last entries in the file

This is your name and email address for users of this language to contact should some translations be unclear

Replace `CHARSET' with utf-8 - all translations of webERP must use utf-8

Historically, due to the fact that the utf-8 contains so many characters, fonts that can display them all are necessarily very large. Whilst it is possible to create utf-8 fonts to work with the fpdf class that creates the pdf reports in webERP, the file size of such reports makes them inpractical to use over dialup connections and is therefore webERP could not use utf-8. Javier de Lorenzo-Cáceres pioneered the use of Adobe CID fonts in webERP with Nicola Asuni's TCPDF PDF creation class itself a development of Olivier Plathey's FPDF. Javier has written some technical description of how he was able to achieve this.

The character encoding name - always utf-8 - can be written in either upper or lower case. Usually upper case is preferred.

Set this to 8bit


Once this has been completed the file must be returned to the project administrator: for the .mo file to be created. The new directory will be returned in a zip file for extraction from the web-erp directory. The language will then be added to the webERP system for the benefit of other users as well.

Upon logging into the system each time the system sets the language used by looking up the user information to see what language they have set. The user can change which language is set by clicking on their user name at the top left which brings up User Settings. Changing the language setting will activate the new language right away upon saving the change. Only languages for which there is a directory under the locale directory can be selected by the user.

Other Resources

The GNU gettext manual:

Notes on GetText

Internationalization Internationalization
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki