Revision [1773]

This is an old revision of HowToTranslate made by PhilDaintree on 2010-03-31 01:30:49.

 

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.

Procedure


1. Join the mailing list at:

http://lists.sourceforge.net/lists/listinfo/web-erp-translation

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.po file can be downloaded from:

http://www.weberp.org/weberp/locale/en_GB/LC_MESSAGES/messages.po

Or you can download the very latest strings from the CVS at:

http://web-erp.cvs.sourceforge.net/*checkout*/web-erp/webERP/locale/en_GB/LC_MESSAGES/messages.po

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.

It is especially important to ensure that the string "ISO-8859-1" (around line 19400 in the messages.po file) is translated to be the character set that you wish your translation to use. webERP uses the translated string here to send appropriate html headers so your browser knows how to interpret the characters sent. eg. for a Chinese translation :

msgid = "ISO-8859-1"
msgstr = "Big5"



A new folder under webERP/locale/ needs to be created with the locale abbreviation for your language some examples:

fr_FR - French
en_US - English US
de_DE - German

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

webERP/locale/de_DE

and the folder below this called LC_MESSAGES

webERP/locale/de_DE/LC_MESSAGES

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

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

Return the messages.po file containing your translations to info@weberp.org

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

en_GB - english underscore Great Britain
en_US - english underscore United States
en_AU - 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.

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. messages.mo 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/LC_MESSAGES/ directory in the SVN.
However, the most recent messages template file will be emailed on request to the project administrator at info@webrp.org or any request to the translation list.

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 ê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


Project-Id-Version
Should be webERP - version number

PO-Revision-Date
This is the date of your last entries in the file

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

Content-Type
Replace `CHARSET' with the character encoding used for your language, in your locale, or UTF-8.
In the GNU system, the following encodings are frequently used for the corresponding languages:

* ISO-8859-1 for Afrikaans, Albanian, Basque, Catalan, Dutch, English, Estonian, Faroese, Finnish, French, Galician, German, Greenlandic, Icelandic, Indonesian, Irish, Italian, Malay, Norwegian, Portuguese, Spanish, Swedish,
* ISO-8859-2 for Croatian, Czech, Hungarian, Polish, Romanian, Serbian, Slovak, Slovenian,
* ISO-8859-3 for Maltese,
* ISO-8859-5 for Macedonian, Serbian,
* ISO-8859-6 for Arabic,
* ISO-8859-7 for Greek,
* ISO-8859-8 for Hebrew,
* ISO-8859-9 for Turkish,
* ISO-8859-13 for Latvian, Lithuanian,
* ISO-8859-15 for Basque, Catalan, Dutch, English, Finnish, French, Galician, German, Irish, Italian, Portuguese, Spanish, Swedish,
* KOI8-R for Russian,
* KOI8-U for Ukrainian,
* CP1251 for Bulgarian, Byelorussian,
* GB2312, GBK, GB18030 for simplified writing of Chinese,
* BIG5, BIG5-HKSCS for traditional writing of Chinese,
* EUC-JP for Japanese,
* EUC-KR for Korean,
* TIS-620 for Thai,
* UTF-8 for any language, including those listed above.

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 difficult to use over dialup connections and is therefore it is recommended NOT to use utf-8 unless one of the more specific character sets will not suffice.

UPDATE: The latest versions of webERP now use the TCPDF class to create pdf reports - through clever use of CIF fonts Javier de Lorenzo-Cáceres has enabled utf-8 pdf reporting using the bundled fonts in adobe acrobat reader - without the requirement to bundle the font with the report and therefore making the report size managable even over dialup. webERP is now able to use utf-8 throughout realising a truly multi-language system.


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

Content-Transfer-Encoding
Set this to 8bit


Administration

Once this has been completed the file must be returned to the project administrator: submissions@weberp.org 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:

http://www.gnu.org/software/gettext/manual/html_chapter/gettext_toc.html#SEC_Contents

Notes on GetText

*Online reviews about webERP
webERP 3.11 User Reviews
- Review from Ohloot, an open source directory that anyone can edit. It features comprehensive metrics and analysis on thousands of open source projects
- Ranking from Linux Seeker

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