Translator documentation: Difference between revisions

Jump to navigation Jump to search
Line 32: Line 32:


=== Using TX command line client (for Dolibarr [[:Category:Yoda]] team) ===
=== 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.
This describes how to use Transifex from the command line. However, this is reserved to Dolibarr admin users to synchronize Transifex with Dolibarr main sources.


[http://docs.transifex.com/developer/client/ Official documentation]
[http://docs.transifex.com/developer/client/ Official documentation]
Line 97: Line 97:
<nowiki>[main] section</nowiki>
<nowiki>[main] section</nowiki>


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


<nowiki>[dolibarr.resource]</nowiki>
<nowiki>[dolibarr.resource]</nowiki>
Line 136: Line 136:
-l <lang> - Specify which translations you want to pull (defaults to all)
-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)
-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)
-a - Fetch all translation files from the server (even new ones)
-s - Force the fetching of the source file (default: False)
-s - Force the fetching of the source file (default: False)
-f - Force download of translations files
-f - Force download of translations files
Line 174: Line 174:


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, the new changes into transifex will be available only for next branch. The reason for 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, the new changes into transifex will be available only for the next branch. The reason for this is that transifex is not able to manage branch/versions (not yet).


== Manual Translation (not recommended) ==
== Manual Translation (not recommended) ==
Line 189: Line 189:
</source>
</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.
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.


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:
Line 212: Line 212:
* Translator OS: All
* Translator OS: All
* Tool: '''autotranslator.php''' provided with Dolibarr in directory '''dev/translation'''.
* 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).
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 a 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:
To make or update all files of a language code, just run the script:
Line 224: Line 224:
to translate into Portuguese (pt_PT) using English (en_US) files.
to translate into Portuguese (pt_PT) using English (en_US) files.


All non existing files will be created, all existing files will be updated.
All nonexisting 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).
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.
Your PHP must also have permissions to write into '''htdocs/langs''' directory and must have curl functions available.


15

edits

Navigation menu