Translator documentation: Difference between revisions

Jump to navigation Jump to search
Line 61: Line 61:
== Manual translation ==
== Manual translation ==


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 (already translated) from an existing language directory (for example en_US/main.lang, en_GB/bills.lang), into the new language directory that we had just created.
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 we have just created.


These files have the following format of key/value pairs in each line:
These files have the following format of key/value pairs in each line:
Line 72: Line 72:
</source>
</source>


Translate the sentences or phrases (the value part) present on the right side of "=" as seen above, the code (the key part) 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) 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, which can be done 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:


<source lang="php">
<source lang="php">
304

edits

Navigation menu