Since each language file is a .php
file, it must follow the syntax rules of the PHP programming language. The language file is a sequence of array element definitions. Each definition has two parts. The text that should be translated is the one on the right side of the equal sign (=) and enclosed in single quotes ( ' ). Element definition example:
$msg_arr['btn_help'] = 'Help'; |
where:
btn_help
is called a keyword;Help
is the text that must be translated.When translating the interface language file, keep in mind the following:
Translate only the text that follows after the equal sign.
This can accidentally happen if you use the Search and Replace All function available in most text editors.
If the text contains single quotes, then you must insert a backslash ( \ ) in front of the quote, like in the example below:
'Don\'t forget to escape single quotes in this text.' |
The language files also contain some special elements called template fields. They are automatically replaced by context–specific information. The replaceable text is delimited by braces:
{template field}. |
Example of a language file entry containing a template field:
$msg_arr['i_ext_type'] = 'Extension type is {type}'; |
In the VoipNow interface, the {type}
parameter can be replaced by one of the nine extension types available. For example:
Extension type is queue. |
Use a text editor with PHP error-checking capabilities. It is essential not to have PHP syntax errors in the language interface files. To make sure that the translated files are valid, you can use a text editor that can check the PHP code and find errors. There are many editors with this capability, paid or free-ware, shareware or open-source. One example is jEdit, a free and powerful text editor. The PHP parser function can be installed as a plug-in. Other examples are NotePad++ and Eclipse.