Parts of TNG have already been translated into 21 languages (besides English), but there are quite a few languages that are not supported as of yet. If you have thought about translating TNG into a new language, here’s what you’ll need to do.
First, use an FTP program or the file manager on your site control panel to navigate into the “languages” folder and create a new folder for your new language. You should see folders for all the other languages there, like this:
- Afrikaans
- Afrikaans-UTF8
- Arabic-UTF8
- Croatian
- Croatian-UTF8
The “-UTF8” at the end of some folders means that the files in that folder are UTF-8 encoded. If your data or your new language uses letters or characters outside of the standard 26-character alphabet used in English, you should name your new folder in similar fashion (e.g., “Hebrew-UTF8”).
Next, copy the files from the folder of your native language (use the “-UTF8” version if your new language will also be using UTF-8) and paste them into your new folder. The files should be named admintext.php, alltext.php and text.php.
Now go in TNG to Admin/Languages and create a new language record for your new language. Select your new language folder in the “Language folder” dropdown box. Put “UTF-8” in the character set field if your new language will be UTF-8 encoded. Otherwise use “ISO-8859-1” as the character set. Click the “Help for this area” link for hints on any of the fields or options. Don’t forget to save. Also, if this is the first language record you’ve created under Admin/Languages, you must also create a record for your primary language. If you forget to do that, you won’t be able switch back when you try out your new language later!
Finally (and this is the biggest step), edit the files you pasted into your new folder and translate the messages. You can do this by editing the files right on your site, or you can download them to your computer and edit them there. Be sure to use a pure text editor (not MS Word or anything that will add formatting). Notepad++ (Windows) and TextEdit (Mac) are good options. If you are creating a UTF-8 file, you might need to select UTF-8 as the encoding type (no byte order mark, or BOM).
When you’re doing the translations, be sure to translate only the messages and not the “keys”. For example, the messages you see will look something like this:
- $text[‘family’] = “Family”;
- $text[‘birth’] = “Birth”;
In these examples, the keys are what you see inside the square brackets. The messages are what you see between the double quotes. In the end, your new translations will look something like this:
- $text[‘family’] = “сям’я”;
- $text[‘birth’] = “нараджэння”;
One other thing to remember is that double quotes within the message need to be “escaped” with a backslash. An escaped message looks something like this:
- $text[‘message’] = “This is an \”escaped\” message”;
If you forget to escape the nested quotes, your site may show only blank pages until you fix it.
When you’re done, save the files and copy them back to your website if necessary. To see your work in action, choose the new language from the language dropdown box on any page of your site. If you weren’t sure of the context while doing the translation, you might want to check to see if any guesses you made were correct, then go back and correct them if necessary.
And one more thing: If you feel inclined to share, I would love to include your new translations in future versions of TNG so others can benefit. Good luck, and let me know if you have any questions!
Note that Notepad++ is not a Windows product.
See http://tng.lythgoes.net/wiki/index.php/Notepad-plus-plus
PSPad and other text editors can be used. The Windows provided Notepad editor adds a Byte Order Mark (BOM) in front of the <?php which causes problems which often show up as a blank page.