<keywords content="traduction, documentation, traducteur, localisation, localiser, internationalise, langage" />

Language.png Traduire l'application Dolibarr dans une autre langue

Dolibarr est livré avec plusieurs langues. Par défaut, l'Anglais est toujours complet. Les autres langues dépendent des contributions. Cette documentation vous présente comment traduire les fichiers langues pour ajouter une langue non traduite ou traduite de manière incomplète.

Il existe 3 méthodes pour réaliser la traduction de Dolibarr:

  1. Automatique avec autotranslator.php
  2. Manuelle par modification des fichiers langues
  3. Manuelle en utilisant Transifex.com (officielle et recommandée).

Les voici par ordre inverse de préférences:

Traduction automatique avec l'outil autotranslator.php

  • OS du traducteur: Tous
  • Outil: autotranslator.php fourni avec Dolibarr dans le répertoire dev/translation.

Pour traduire ou mettre à jour tous les fichiers dans une nouvelle langue, lancez simplement le script:

php autotranslator.php lang_code_source lang_code_target GOOGLEAPIKEY

Par exemple :

php autotranslator.php en_US pt_PT GOOGLEAPIKEY

pour traduire en portugais (pt_PT) en utilisant l'anglais (en_US) comme fichiers sources.

Tous les fichiers non existant seront créés, et ceux existant déjà seront mis à jour pour être complétés avec les chaines manquantes. Les chaines déjà traduites sont conservées tel quelles. L'outil utilise le service de traduction Google pour trouver la valeur traduite d'une chaine, aussi un accès internet depuis le poste où est lancé la commande est requis. De plus, une clé pour utiliser les API Google Translate sont nécessaire et Google fait payer l'utilisation de cette API (20 $ / 1 000 000 de caractères traduits). Votre PHP doit de plus avoir les permissions d'écrire dans le répertoire htdocs/langs directory et doit avoir les fonctions de l'extension curl disponibles.

Traduction manuelle complètement (non recommandé)

Pour traduire Dolibarr dans une autre langue, il faut aller dans le répertoire langs et créer un répertoire ayant pour nom le code langue à traduire (En suivant le même format que ceux déjà existant, par exemple en_US, fr_FR, es_ES, de_DE, etc...). Il faut ensuite recopier les fichiers lang depuis un répertoire déjà traduit (par exemple en_US/main.lang ou fr_FR/bills.lang), les recopier dans le répertoire de la nouvelle langue que l'on vient de créer et traduire le contenu de ces fichiers.

Ces fichiers sont constitués de la manière suivante:

Code1=Phrases à traduire 1
Code2=Phrases à traduire 2
...
Coden=Phrases à traduire n

Seules les phrases à droite du = sont à traduire, le code doit rester inchangé. Il est possible de traduire les fichiers un par un, sans tous les traduire d'un coup. Si un fichier n'a pas été traduit dans la nouvelle langue, Dolibarr utilisera l'anglais.

Pour avoir une chaine variable selon la langue dans le code PHP, tout ce que vous avez à faire et de charger le fichier lang et d'utiliser la méthode pour récupérer la variable traduite. Ceci peut se faire de la manière suivante:

$langs->load("nomdufichier"); // ou $langs->load("nomdufichier@monmodule") si monfichier.lang est dans le répertoire htdocs/monmodule/langs/xx_XX   

print $langs->trans("CodeX")

Et une entrée du type

CodeX=Phrase X

doit être ajoutée aux fichiers .lang

Traduction via transifex (recommandé)

  Page waiting for translation. To translate, create an account, go back and clic on "Modify".
  Page en attente de traduction. Pour traduire, créez un compte, revenez et cliquez sur "Modifier".
  Página a traducir. Para traducirla, cree una cuenta, vuelva a la página y haga clic en "editar".
  Pagina da tradurre. Per tradurla, crea un utente, torna indietro e clicca su "modifica".
  Página a aguardar por tradução. Para traduzir, crie uma conta, volte atrás e clique em "Modificar".
  Seite wartet auf Übersetzung. Um Übersetzung zu erstellen, richte einen Account ein, geh zurück und klicke auf "bearbeiten".
  页面等待翻译。若要翻译本页,先创建一个帐户、登录并返回本页后单击“编辑”。

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:

  • en_US
  • pt_BR
  • xx_ES (except if xx is es, eu or ca)

(this languages are still maintained using git).

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:

apt-get install python-pip
pip install transifex-client

Then you have to initialize your TX environment. This is done by running tx init into dolibarr project root directory.

cd git/dolibarr
tx init

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:

.
|-- build
|-- build.xml
|-- ChangeLog
|-- COPYING
|-- COPYRIGHT
|-- dev
|-- doc
|-- .gitignore
|-- htdocs
|-- INSTALL
|-- pom.xml
|-- quickbuild.xml
|-- README
|-- README-FR
|-- README.md
|-- robots.txt
|-- scripts
|-- test
`-- .tx

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:

[main]
host = https://www.transifex.com

[dolibarr.admin]
file_filter = htdocs/langs/<lang>/admin.lang
source_file = htdocs/langs/en_US/admin.lang
source_lang = en_US
type = MOZILLAPROPERTIES

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.<lang>: 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:

-h - Shows the help screen for the command
-l <lang> - Specify which translations you want to push (defaults to all)
-r <resource> - Specify the resource for which you want to push the translations (defaults to all)
-f - Push source files without checking modification times
--skip - Don't stop on errors. Useful when pushing many files concurrently.
-s - Push the source file to the server
-t - Push the translation files to the server
--no-interactive - Don't require user input when forcing a push

tx pull

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

-h - Shows the help screen for the command
-l <lang> - Specify which translations you want to pull (defaults to all)
-r <resource> - Specify the resource for which you want to pull the translations (defaults to all)
-a - Fetch all translation files from server (even new ones)
-s - Force the fetching of the source file (default: False)
-f - Force download of translations files
--skip - Don't stop on errors. Useful when pushing many files concurrently.
--disable-overwrite - By default Transifex will fetch new translations files and replace existing ones. Use this flag if you want to disable this feature.
--minimum_perc=VALUE - Specify the minimum acceptable percentage of a translation in order to download it.

Examples

To pull translation files, you can use:

tx -d pull -l it_IT  # Get italian language only
tx -d pull -a   # Get all languages

To push source files, just type:

tx -d push -t -l it_IT [-r dolibarr.file]   # To push only a specific translation file
tx -d push -s  # To push source file

Language.png Diffusion ou intégration en standard de votre traduction

Dans les sources Dolibarr officielles

La meilleure chose à faire, après avoir réalisé une traduction, est de les inclure dans la version officielle de Dolibarr.

Si vous avez complété des fichiers .lang existant déjà dans Dolibarr mais incomplets ou si vous avez créé des nouveaux fichiers .lang pour une nouvelle langue, vous pouvez :

  • Si la traduction a été faite en utilisant le système Transifex, il n'y a rien de particulier à faire. Votre traduction sera intégré lors des synchros régulières qui ont lieu avec les sources Git officielles (au moins 1 par mois).
  • Si la traduction a été faite dans des fichiers directement pour les langues en_US, pt_BR, xx_ES (où xx est ni ca, ni eu, ni es), il est possible de les intégrer si vous connaissez le système GIT. Pour cela, créer un compte sur https://github.com/Dolibarr/dolibarr, forker le projet, modifier les fichiers concernés et envoyer une Pull Request.


Remarque: Il y a une langue maitre toujours complète:

  • L'anglais (fichiers .lang du répertoire lang/en_US)

Tous les autres fichiers langues sont susceptibles d'être incomplets.

En tant qu'extension

Quand vous avez créer une nouvelle langue, si elle n'est pas intégrée dans Dolibarr, elle peut être malgré tout diffuser pour d'autres utilisateurs. Vous pouvez fabriquer un package pour la distribuer en utilisant le script build/makepack-dolibarrlang.pl ou en réalisant un zip de manière manuel que vous posterez sur dolistore.com ou sur la mailing-list des développeurs dolibarr-dev (Inscription sur https://savannah.nongnu.org/mail/?group=dolibarr).

Le fichier fabriqué doit juste être dézippé dans le répertoire Dolibarr pour que la langue soit disponible.

Language.png Traduire la documentation du wiki

Le wiki est maintenu en 3 langues: Englais, Français et Espagnol. Si vous voulez améliorer la documentation d'une de ces langues, il vous suffit de créer un compte sur ce wiki. Ensuite, vous pouvez modifier toute page qui possède une traduction incorrecte ou traduire une page qui attend d'être traduite. La liste de ces pages est disponible sur la page Category:Page_waiting_for_translation.