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. Go to the projects discussions at: https://github.com/timschofield/webERP/discussions/categories/translations Let people know you're wanting to help with a translation - someone may already be working on it.
  2. If there is no-one else working on a translation there is a choice to make. Obtain the latest messages.po file to edit manually. There are tools available to edit this file quite efficiently and this is probably quicker in the longer run if there is only one person working on the translation.

Editing the message.po Manually

The latest messages.po file can be downloaded from: https://github.com/timschofield/webERP/blob/master/locale/en_GB.utf8/LC_MESSAGES/messages.pot

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.

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

An archive of the new language directory and instructions on how to use it will be emailed for your use. The new directory created by the project admin will be added to the webERP distribution for future releases

Using the WEB Based Tools To Translate Collaboratively Point your browser to: http://www.weberp.org/translate/index.php A user name of: translator With a password of: language is required to access this private area. The webERP username of: demo and password of : weberp can be used to get into the system. It is then recommended that you create a new user for yourself by going to setup, User Accounts and entering some details as necessary. Logout from demo and login under the user name just created. Now click on your user name in the top left of the screen to modify your settings. All the languages that are being worked on are available for selection. If your language is there then select it. If your language is not there already a new language can be created using the utilities and the new language code must be entered. The translation utilities are available from the quick menu at the very top of this screen. 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). Having created the new language change your user account to always use this language. The translation utilities refer to each script as a module. Each module can be selected for translation using the web interface and the translation together with the english string are shown for all the text strings on that page. It is important not to enter the " character in any translations. Once the translations are entered you can go to the page that has been translated and see the effect of your translations immediately in the system. The advantage of the web based system is that the changes are immediately obvious to another translator who will not duplicate work that has already been done. When there have been changes to the underlying scripts and new strings need to be translated these will need to be merged into the translation messages.po file you have been working on. Again this can be done from the translation utilites. It is recommended that translations start with the index.php module since this main menu is the most visible of all pages. When changing a module's translation it is important to click the "Modify" to ensure the changes to translations are updated. Also, due to the nature of the web it is always appropriate to backup your work after you have done significant amounts of translation by downloading the messages.po after every session make a favouites/bookmark for the translation: http://www.weberp.org/translate/locale/xx_XX/LC_MESSAGES/messages.po where xx_XX is the locale name of your translation. You can use this file to test the translation of your local installation. 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) Understanding the messages.po File The translation is performed by tranlating 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/ deirectory in the CVS. 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 , 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. When single quote characters or double quote characters are used in translations for your language, and your locale's encoding is one of the ISO-8859-* charsets, it is best if you create your PO files in UTF-8 encoding, instead of your locale's encoding. This is because in UTF-8 the real quote characters can be represented (single quote characters: U+2018, U+2019, double quote characters: U+201C, U+201D), whereas none of ISO-8859-* charsets has them all. Users in UTF-8 locales will see the real quote characters, whereas users in ISO-8859-* locales will see the vertical apostrophe and the vertical double quote instead (because that's what the character set conversion will transliterate them to). 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 exercise has been completed the file must be returned to the project administrator: info@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. Future archives will include the translations submitted. 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, for instance it or en. Notice it is always two lower case characters. 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. If a language is chosen for which there is no translation (yet) then the system will continue to work but default to English still. Other Resources The GNU gettext manual: http://www.gnu.org/software/gettext/manual/html_chapter/gettext_toc.html#SEC_Contents