59
edits
| (4 intermediate revisions by 2 users not shown) | |||
| Line 7: | Line 7: | ||
[[zh:翻译文档]] | [[zh:翻译文档]] | ||
<!-- END interlang links --> | <!-- END interlang links --> | ||
{{#metamaster:keywords|translation, documentation, translator, localize, localization, i18n, l18n, internationalization, language}} | |||
=[[File:Language.png]] Translate Dolibarr Application into your language= | |||
Dolibarr language files are already translated in several languages. | |||
English is the default and always complete. Other languages depend on contributions. This tutorial can help you complete a translation for a language not yet available or somehow incorrect. | |||
Dolibarr can be translated by three different means: | Dolibarr can be translated by three different means: | ||
| Line 27: | Line 26: | ||
===Using the web interface (for translators)=== | ===Using the web interface (for translators)=== | ||
If you want to help to translate Dolibarr in your own language, check the project's page at https:// | If you want to help to translate Dolibarr in your own language, check the project's page at https://app.transifex.com/dolibarr-association/dolibarr/dashboard/ | ||
You can then register an account and request joining the project team for the language(s) you're targeting. A manager will have to accept your request, so please be patient. | You can then register an account and request joining the project team for the language(s) you're targeting. A manager will have to accept your request, so please be patient. | ||
| Line 49: | Line 48: | ||
First install TX Client. | First install TX Client. | ||
With Debian/Ubuntu/Mint: | With Debian/Ubuntu/Mint: | ||
< | <syntaxhighlight lang="bash"> | ||
apt-get install python-pip | apt-get install python-pip | ||
pip install transifex-client | pip install transifex-client | ||
</ | </syntaxhighlight> | ||
Then you have to initialize your TX environment. This is done by running '''tx init''' into dolibarr project root directory. | Then you have to initialize your TX environment. This is done by running '''tx init''' into dolibarr project root directory. | ||
< | <syntaxhighlight lang="bash"> | ||
cd git/dolibarr | cd git/dolibarr | ||
tx init | tx init | ||
</ | </syntaxhighlight> | ||
Accept to overwrite config file. Keep default value for Transifex instance, then enter your Transifex login and password. | Accept to overwrite config file. Keep default value for Transifex instance, then enter your Transifex login and password. | ||
| Line 91: | Line 90: | ||
That is a sample of what the config file contains: | That is a sample of what the config file contains: | ||
< | <syntaxhighlight lang="ini"> | ||
[main] | [main] | ||
host = https://www.transifex.com | host = https://www.transifex.com | ||
| Line 101: | Line 100: | ||
source_lang = en_US | source_lang = en_US | ||
type = MOZILLAPROPERTIES | type = MOZILLAPROPERTIES | ||
</ | </syntaxhighlight> | ||
Here is an explanation of the sections and options used in the config file: | Here is an explanation of the sections and options used in the config file: | ||
| Line 157: | Line 156: | ||
To pull translation files, you can use: | To pull translation files, you can use: | ||
< | <syntaxhighlight lang="bash"> | ||
tx -d pull -l it_IT # Get italian language only | tx -d pull -l it_IT # Get italian language only | ||
tx -d pull -a # Get all languages | tx -d pull -a # Get all languages | ||
</ | </syntaxhighlight> | ||
To push source files, just type: | To push source files, just type: | ||
< | <syntaxhighlight lang="bash"> | ||
tx -d push -t -l it_IT [-r dolibarr.file] # To push only a specific translation file | 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 | tx -d push -s # To push source file | ||
</ | </syntaxhighlight> | ||
===Other questions on transifex process=== | ===Other questions on transifex process=== | ||
This is short questions and answers you may also ask about transifex translation process: | This is short questions and answers you may also ask about transifex translation process: | ||
1) Is the sync on a regular time interval? | 1) Is the sync done on a regular time interval? | ||
No. It is done where there is enough translation submitted. It is also done on a beta branch just before creating the final release package. | No. It is done where there is enough translation submitted. It is also done on a beta branch just before creating the final release package. | ||
2) Are all the translations synced to git or only the reviewed translations? Do I need to review before sync is done? | 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. | 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 a review before sync is done. Making review is above all to know which lines were manually reviewed and which one was initially translated using a robot. | You don't have to make a review before sync is done. Making review is above all to know which lines were manually reviewed and which one was initially translated using a robot. The sync always take the last translated version, even if the new translation was not reviewed. | ||
3) In which Dolibarr releases will translations be available? Are | 3) In which Dolibarr releases will translations be available? Are Transifex translations also synced to maintenance releases? | ||
Sync is always done on develop and/or beta. | Sync is always done on develop and/or beta. | ||
So | So Transifex changes appear in all versions whose branch is created after the Transifex change (a sync is always done before creating a new branch). Once a branch is created, the new changes into Transifex will be available only for the next branch. The reason for this is that we do not manage branch/versions on Transifex (not yet). | ||
==Manual Translation (not recommended)== | ==Manual Translation (not recommended)== | ||
| Line 192: | Line 191: | ||
These files have the format of key/value pairs in each line like the followings: | These files have the format of key/value pairs in each line like the followings: | ||
< | <syntaxhighlight lang="ini"> | ||
Code1 = translate phrase 1 | Code1 = translate phrase 1 | ||
Code2 = translate phrase 2 | Code2 = translate phrase 2 | ||
... | ... | ||
Coden = translate phrase n | Coden = translate phrase n | ||
</ | </syntaxhighlight> | ||
Translate the phrases (the value portion of the key/value pairs) on the right side of the "=" as seen above, the code (the key portion) on the 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. | Translate the phrases (the value portion of the key/value pairs) on the right side of the "=" as seen above, the code (the key portion) on the 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. | ||
| Line 203: | Line 202: | ||
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: | 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: | ||
< | <syntaxhighlight lang="PHP"> | ||
$langs->load("myfile"); // or use $langs->load("myfile@mymodule") if myfile.lang is inside directory htdocs/mymodule/langs/xx_XX | $langs->load("myfile"); // or use $langs->load("myfile@mymodule") if myfile.lang is inside directory htdocs/mymodule/langs/xx_XX | ||
print $langs->trans("CodeX") | print $langs->trans("CodeX") | ||
</ | </syntaxhighlight> | ||
An entry type; | An entry type; | ||
< | <syntaxhighlight lang="ini"> | ||
CodeX = phrase X | CodeX = phrase X | ||
</ | </syntaxhighlight> | ||
must be present or added to the myfile.lang file. | must be present or added to the myfile.lang file. | ||
| Line 226: | Line 225: | ||
To make or update all files of a language code, just run the script: | To make or update all files of a language code, just run the script: | ||
< | <syntaxhighlight lang="bash"> | ||
php autotranslator.php lang_code_source lang_code_target GOOGLEAPIKEY | php autotranslator.php lang_code_source lang_code_target GOOGLEAPIKEY | ||
</ | </syntaxhighlight> | ||
For example : | For example<span> </span>: | ||
< | <syntaxhighlight lang="bash"> | ||
php autotranslator.php en_US pt_PT GOOGLEAPIKEY | php autotranslator.php en_US pt_PT GOOGLEAPIKEY | ||
</ | </syntaxhighlight> | ||
to translate into Portuguese (pt_PT) using English (en_US) files. | to translate into Portuguese (pt_PT) using English (en_US) files. | ||
| Line 265: | Line 264: | ||
====Create a new page for the translated version.==== | ====Create a new page for the translated version.==== | ||
Start by creating a new page for the translated version. To do this, you can access an non existant URL : for example [[Translator documentation|<code>https://wiki.dolibarr.org/index.php/Ma_nouvelle_page_en_français</code>]] | Start by creating a new page for the translated version. To do this, you can access an non existant URL<span> </span>: for example [[Translator documentation|<code>https://wiki.dolibarr.org/index.php/Ma_nouvelle_page_en_français</code>]] | ||
The chosen title for the translated version of the page should be the translation of the title of the original English page. | The chosen title for the translated version of the page should be the translation of the title of the original English page. | ||
edits