Line 7: |
Line 7: |
| Dolibarr can be translated in three different ways: | | Dolibarr can be translated in three different ways: |
| | | |
| + | # Manually using Transifex.com (that's the official and recommended method). |
| + | # Manually editing language files |
| # Completely automatic: autotranslator | | # Completely automatic: autotranslator |
− | # Manually editing language files
| |
− | # Manually using Transifex.com (that's the official and recommended method).
| |
− |
| |
− | == Automatic Translation with autotranslator.php tool ==
| |
− |
| |
− | * Translator OS: All
| |
− | * Tool: '''autotranslator.php''' provided with Dolibarr in directory '''dev/translation'''.
| |
− | 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).
| |
− |
| |
− | To make or update all files of a language code, just run the script:
| |
− | <source lang="bash">
| |
− | php autotranslator.php lang_code_source lang_code_target GOOGLEAPIKEY
| |
− | </source>
| |
− | For example :
| |
− | <source lang="bash">
| |
− | php autotranslator.php en_US pt_PT GOOGLEAPIKEY
| |
− | </source>
| |
− | 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 [http://translate.google.com 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:
| |
− |
| |
− | <source lang="ini">
| |
− | Code1 = translate phrase 1
| |
− | Code2 = translate phrase 2
| |
− | ...
| |
− | Coden = translate phrase n
| |
− | </source>
| |
− |
| |
− | 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:
| |
− |
| |
− | <source lang="php">
| |
− | $langs->load("myfile"); // or use $langs->load("myfile@mymodule") if myfile.lang is inside directory htdocs/mymodule/langs/xx_XX
| |
− |
| |
− | print $langs->trans("CodeX")
| |
− | </source>
| |
− |
| |
− | An entry type;
| |
− |
| |
− | <source lang="ini">
| |
− | CodeX = phrase X
| |
− | </source>
| |
− |
| |
− | must be present or added to the myfile.lang file.
| |
| | | |
| | | |
Line 222: |
Line 172: |
| Sync is always done on develop and/or beta. | | Sync is always done on develop and/or beta. |
| 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). | | 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). |
| + | |
| + | |
| + | |
| + | |
| + | == 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: |
| + | |
| + | <source lang="ini"> |
| + | Code1 = translate phrase 1 |
| + | Code2 = translate phrase 2 |
| + | ... |
| + | Coden = translate phrase n |
| + | </source> |
| + | |
| + | 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: |
| + | |
| + | <source lang="php"> |
| + | $langs->load("myfile"); // or use $langs->load("myfile@mymodule") if myfile.lang is inside directory htdocs/mymodule/langs/xx_XX |
| + | |
| + | print $langs->trans("CodeX") |
| + | </source> |
| + | |
| + | An entry type; |
| + | |
| + | <source lang="ini"> |
| + | CodeX = phrase X |
| + | </source> |
| + | |
| + | must be present or added to the myfile.lang file. |
| + | |
| + | |
| + | == Automatic Translation with autotranslator.php tool == |
| + | |
| + | * Translator OS: All |
| + | * Tool: '''autotranslator.php''' provided with Dolibarr in directory '''dev/translation'''. |
| + | 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). |
| + | |
| + | To make or update all files of a language code, just run the script: |
| + | <source lang="bash"> |
| + | php autotranslator.php lang_code_source lang_code_target GOOGLEAPIKEY |
| + | </source> |
| + | For example : |
| + | <source lang="bash"> |
| + | php autotranslator.php en_US pt_PT GOOGLEAPIKEY |
| + | </source> |
| + | 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 [http://translate.google.com 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. |
| | | |
| = [[File:Language.png]] Distribute or include your translation into core source = | | = [[File:Language.png]] Distribute or include your translation into core source = |