31,003
edits
mNo edit summary |
mNo edit summary |
||
| Line 10: | Line 10: | ||
There is 2 methods: | There is 2 methods: | ||
<source lang="ini"> | |||
$langs->trans('TRAD_STRING'); | $langs->trans('TRAD_STRING'); | ||
</source> | |||
This methode return translation of key TRAD_STRING, and encode result into HTML entities to allow to output it correctly (even with special characters) into an HTML page. | This methode return translation of key TRAD_STRING, and encode result into HTML entities to allow to output it correctly (even with special characters) into an HTML page. | ||
<source lang="ini"> | |||
$langs->transnoentitiesnoconv('TRAD_STRING'); | $langs->transnoentitiesnoconv('TRAD_STRING'); | ||
</source> | |||
This method return translation of key TRAD_STRING, but result is translated string with no particular encoding (string is stored in UTF-8 in memory). | This method return translation of key TRAD_STRING, but result is translated string with no particular encoding (string is stored in UTF-8 in memory). | ||
| Line 20: | Line 24: | ||
Note: If, as arguments, you use a string that is itslef a translated string, you must use method $langs->transnoentitiesnoconv, otherwise string will be encoded twice. | Note: If, as arguments, you use a string that is itslef a translated string, you must use method $langs->transnoentitiesnoconv, otherwise string will be encoded twice. | ||
Example: | Example: | ||
<source lang="ini"> | |||
print $langs->trans("STRING_TO_TRANSLATE",$langs->transnoentitiesnoconv("STRING_PARAM1")) | print $langs->trans("STRING_TO_TRANSLATE",$langs->transnoentitiesnoconv("STRING_PARAM1")) | ||
</source> | |||
= Translate Dolibarr into another language = | = Translate Dolibarr into another language = | ||
See page [[Translator documentation]] | See page [[Translator documentation]] | ||