Translator documentation



= Translate Dolibarr into another language =

Dolibarr language files are translated in several languages. English is by default always complete. Other languages depend on contributions. This tutorial can help you to complete a translation that does not exists or is not correct for another language. There are 3 methods for translating Dolibarr:
 * 1) Full automatic: autotranslator
 * 2) Manually editing language files
 * 3) Manually using Transifex.com (official and recommended).

Automatic Translation with autotranslator.php tool
This method is recommended when starting translation for a language not already initialized. If there is already a translation available but you need to add missing key or correct errors, try to use method using Transifex (see later).
 * Translator OS: All
 * Tool: autotranslator.php provided with Dolibarr in directory dev/translation.

To make or update all files of a language code, just run the script: For example : to translate into Portuguese (pt_PT) using English (en_US) files.

All non existing files will be created, all existing files will be updated. The tool use Google translation service to find the translation value of a string, so a working Internet connection is required from station running the script. Also a GOOGLEAPIKEY is required and Google charges a fee for using this service (20 euros / 1 000 000 of translated chars). Your PHP must also have permissions to write into htdocs/langs directory and must have curl functions available.

Manual Translation (not recommended)
To translate Dolibarr into another language, go to the langs directory and create a folder/directory named with the code language to translate (follow the existing format, for example en_US, en_GB, es_ES, de_DE, etc...). Then copy the files from an existing language directory (for example en_US/main.lang, en_GB/bills.lang), into the new language directory that you have just created.

These files have the format of key/value pairs in each line like the followings:

Translate the phrases (the value portion of the key/value pairs) on right side of the "=" as seen above, the code (the key portion) on left side of "=" should remain unchanged. It is possible to translate the files one by one, without bringing them all at once. If a file has not been translated into the new language, Dolibarr uses English.

To have a localised (translated) string into the PHP code, all you have to do is load the language file and use the method to get the translated value, like this:

An entry type;

must be present or added to the myfile.lang file.

Manual Translation using Transifex online service (recommended)
Transifex is a web application that provides an online platform for translation projects. It includes teams and discussion tools, translation memory, glossary, proofreading and a lot of other features. It is quite easy to use and all translations can be uploaded or downloaded through the web interface or using their TX client in a terminal. Transifex is an open source project and the "community edition" can be freely downloaded and installed but we will use the online hosted service.

Create transifex account and choose language
If you want to help translating Dolibarr in your own language, please refer to http://transifex.com/projects/p/dolibarr/ and see if language is already supported. If it exists (many teams are already working for the project), you can ask to join the team and start to translate right away; if there is not a team for your language, you should request a new translation team on Transifex. It can be done directly using transifex.com interface on the website.

Using the web interface (for translators)
If language is already available onto page http://transifex.com/projects/p/dolibarr/, just create an account and follow instruction of transifex web site to translate files. Note, that this web interface must not be used to translate the following languages: (this languages are still maintained using git).
 * en_US
 * pt_BR
 * xx_ES (except if xx=eu, ca or es)
 * nl_BE

Using TX command line client (for Dolibarr Category:Yoda team)
This describe how to use Transifex from command line. However, this is reserved to Dolibarr admin users to synchronize Transifex with Dolibarr main sources.

TX Client configuration
First install TX Client. With Debian/Ubuntu/Mint: Then you have to initialize your TX environment. This is done by running tx init into dolibarr project root directory. Accept to overwrite config file. Keep default value for Transifex instance, then enter your Transifex login and password.

After this, a .transifexrc has been created into your HOME dir and a generic config file has been created as .tx/config in project's root. So your directory's contents will look like that:

The current config file can be downloaded from https://github.com/Dolibarr/dolibarr/tree/develop/.tx, put it into .tx directory, overwriting the one created by tx init

This project configuration file is used to store the project’s details and the file-to-resource mappings.

That is a sample of what the config file contains:

Here is an explanation of the sections and options used in the config file:

[main] section

In this section we have project-wide options, such as the default transifex host for all projects. These can be overriden by each resource, in case it is needed.

[dolibarr.resource]

source_lang: this is the source language of the resource. source_file: this points to the source file directly. file_filter: here we hold the expression used to identify translation files under the specific project. not mandatory trans. : this is used for translation files that don’t follow a common naming schema and the file expression cannot be used to track them. not mandatory host: in case the project doesn’t use the default Transifex server as specified in the [main] section, it can override it using this option. not mandatory

TX Client use
Some useful information on tx commands.

tx status

Show status of translations

tx push

Used to push changes from your computer to Transifex server Additional options for the tx push command are:

tx pull

Used to pull changes from Transifex server to your computer Additional options for the tx pull command are:

Examples

To pull translation files, you can use:

To push source files, just type:

Other questions on transifex process
This is short questions and answer yuo may also ask about transifex translation process:

1) Is the sync on a regular time interval ?

No. It is done where there is enough translation submited. 2) Are all the translations synced to git, or only the reviewed translations. Do I need to review before sync is done ?

When a Sync is done, transifex files overwrites files into git, but only if there is at least on record modified for the file. You don't have to make review before sync is done. Making review is above all to know which lines were manually reviewed and wich one were intially translated using a robot. 3) In which Dolibarr releases will translations be available ? Are transifex translations also synced to maintenance releases ?

Sync is always done on develop branch. So transifex changes appear in all version whose branch is created after the transifex change (a sync is always done before creating a new branch). Once a branch is created, then new changes into transifex will be available only for next branch. Reason of this is that transifex is not able to manage branch/versions (not yet).

= Distribute or include your tanslation into core source =

Into official Dolibarr sources
The best thing once translation is complete, is to include it in the official version of Dolibarr.

If you have completed the translation of already existing and incomplete lang files or if you have created lang files for a new language, you can:


 * If the translation was done by using the Transifex system for languages ​​other than en_US, en_GB, es_ES and ca_ES (see above), no further action is needed. Your translation will be integrated ont the next occurance of our regular synchronization with the official Git sources (at least once a month).
 * If the translation was made on files directly (that should be the case for en_US, en_GB, es_ES and ca_ES languages), it is possible to integrate using the GIT system. To do this, create an account on, fork the project, edit the relevant files and send a Pull Request.

 Note: The reference language is always complete:
 * English (Lang directory lang/en_US)

All other language files are likely to be incomplete.

As an extension
When you create a new language, if it is not already integrated into Dolibarr, it can still be broadcast to all other users. You can make a distribution package using the build/makepack-dolibarrlang.pl script or making a zip archive manually and posting it on dolistore.com or sending it to the developers' mailing list dolibarr-dev.

New language files are immediately available in an installation as soon as the archive is unzipped in the correct directory.

= Translate documentation on wiki = The wiki is written in 3 languages: English, French and Spanish. If you want to enhance documentation on one of these languages, all you have to do is to create an account on this wiki. Then, you can edit existing pages to correct a bad translation or translate pages waiting for translation Category:Page_waiting_for_translation.