Translator documentation: Difference between revisions

Jump to navigation Jump to search
Line 3: Line 3:
= [[File:Language.png]] Translate Dolibarr into another language =
= [[File:Language.png]] Translate Dolibarr into another language =


Dolibarr languages files are translated in several languages.
Dolibarr language files are translated in several languages.
French and English are by default always complete. Other languages depends on contributions. This tutorial can help you to complete a translation that does not exists or is not correct for another language.
French and English are by default always complete. Other languages depend on contributions. This tutorial can help you to complete a translation that does not exists or is not correct for another language.


There are 4 methods for translating Dolibarr (1 automatic: autotranslator, 3 manual: phpLangEditor, iniTranslation and the completely manual method). They are in order of preference:
There are 4 methods for translating Dolibarr (1 automatic: autotranslator, 3 manual: phpLangEditor, iniTranslation and the completely manual method). They are in order of preference:
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 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.
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 following format of key/value pairs in each line:
These files have the format of key/value pairs in each line like the following:


<source lang="ini">
<source lang="ini">
Line 72: Line 72:
</source>
</source>


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

edits

Navigation menu