Translate obscure Joomla template labels with this handy tutorial
Translation is a crucial part of the website-localization process. If you use our J! templates, you may see that some phrases are only in English, even if you have installed the translation of Joomla! itself or a component (e.g. Virtuemart). Bear in mind that some of the untranslated phrases are not from the template but from modules (Check also: How to translate NSP GK5).
Each of our Gavick templates includes one file (.ini) which contains all of the English terms we have used; this allows our users to only edit one file in order to be able to translate our templates to any language in the world. All you have to do is to translate, for example, the language\en-GB\en-GB.tpl_gk_shop_and_buy.ini file.
Remember: that each template has its own filename (en-GB.tpl_gk_fest.ini, en-GB.tpl_gk_game.ini, etc.) so you must be aware of which Gavick template you’re planning to use or which one is set as your default.
How to translate a GavickPro Joomla template?
To translate the front-end of a template, instead of changing the original file, you have to make a copy of this file (from the server, quickstart or template package). Open the .ini file with a text editor which is capable of handling UTF-8. We recommend these free tools: Notepad++ or PSPad if you are using a Windows operating system.
Because some languages require special fonts with the proper font encoding set, a good start is to make sure that you’re using UTF-8 encoding.
Now, you can translate selected entries into your preferred language. Then, use a text editor to translate all strings. Edit the file and translate all phrases or words on the right side of the equals (=) sign to the new language. The left side of each line (left of the equals sign) must remain the same – they are needed by the system. You don’t have to translate all strings from that file, select only those your users will really use.
TPL_GK_LANG_PUBLISHED_IN="Published in %s" TPL_GK_LANG_PUBLISHED_IN_DATE="Published in " TPL_GK_LANG_PUBLISHED_IN_DATE_MODIFY="Last modified: " TPL_GK_LANG_HITS="Hits: %s" (...) TPL_GK_LANG_LOGIN="Log In" TPL_GK_LANG_LOGOUT="Logout" TPL_GK_LANG_REGISTER="Register" TPL_GK_LANG_ALL_RESULTS="View all results" TPL_GK_LANG_NO_RESULTS="No results for specified phrase…" (...) TPL_GK_LANG_ADVERT="Advertisement" TPL_GK_LANG_FB_USER="Facebook user?" TPL_GK_LANG_FB_INFO="You can use your Facebook account to sign into our site." TPL_GK_LANG_LOG_IN="LOG IN" TPL_GK_LANG_OR=" or " TPL_GK_LANG_MY_CART="My Cart" TPL_GK_LANG_MY_CART_LOADING="Loading" TPL_GK_LANG_IS_LOADING="Loading"
You have to save the file as UTF-8 (not BOM).
Then, you have to change the filename from: en-GB.tpl_gk_shop_and_buy.ini to: xx-XX.tpl_gk_shop_and_buy.ini .
Where xx-XX is a LANG-PREFIX
For example:
- fr-FR – for Français
- es-ES – for Spanish (Español)
- de-DE – for German
- pl-PL – for Polish
Tips for a Joomla translator
Try to make sure that your spelling is correct – use a dictionary if you are unsure. Use understandable and well-known phrases for a given situation or buttons you want to describe, in a consistent manner. If you are unsure whether something is common, try to check other websites with a similar focus to yours and examine their labels.
English is a language in which texts are almost always shorter (in characters) than their respective translations, so plan ahead by reserving enough space in a template. Experience shows that very short strings of a few characters length often almost double in size. Extra space for text expansion should be allowed for the translated area, although you can resize your template using the Settings or CSS.
How to use the translated Joomla file
Once the phrases have been translated, you can copy your language file into your language directory using an FTP client or a Joomla! component named eXtplorer or AceFTP. This is an important step if you’re going to build a multi-language website.
If translated strings are displayed incorrectly, you can fix it by saving the file in UTF-8 format. When editing .ini files only use editors which can save files in UTF-8 format. Do not save the file in UTF-8 format with Byte Order Mark (BOM). Saving them as UTF-8 with BOM may cause entirely different problems.
Note: if you forget even one quotation mark(!) – it is probable that your whole translation won’t work at all. So count their appearances; it should be an even number.
What is allowed in .ini files
- The translated string must be enclosed by double quotes. Take care when using Double Quotes (“) in your translation, used incorrectly, it will break the translation.
- Try not to split translations into multiple lines.
This article was first published