Translator documentation: Difference between revisions

Jump to navigation Jump to search
Line 71: Line 71:
Only sentences are = right to translate the code 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 use English.
Only sentences are = right to translate the code 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 use English.


To have a localise tring into the PHP code, all you have to do then is loading the language file use the methode to get the translated value. This ca nbe done like this:
To have a localise string into the PHP code, all you have to do then is loading the language file and use the method to get the translated value. This can be done like this:


<source lang="php">
<source 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   
$langs->trans("CodeX")
 
print $langs->trans("CodeX")
</source>
</source>


Line 84: Line 85:
</source>
</source>


must be added to the files. lang
must be added to the myfile.lang file.


== Integrate its translation into Dolibarr ==
== Integrate its translation into Dolibarr ==

Navigation menu