July 2008
Developer: Localization Advancements in Joomla! 1.5
Preparing your extensions for multilanguage support
Written by József Tamás Herczeg
We all know Joomla! is an international project. In Joomla! 1.5 there were giant steps regarding internationalization. Among other things it supports UTF-8 encoding what ensures the proper display of the characters for each language, RTL (Right-To-Left) languages, and a much more convenient language file format was introduced. Not only the front-end but the back-end is also localizable what we waited so much. I remember, the dauntless international community members sparing no troubles released their fully localized Joomla! 1.0 versions by hacking the code directly it is the past now.
The localization possibilities in Joomla! 1.5 try to force an open door: not only the components, but the interface of the modules, plugins and templates can have multilanguage support. It is wonderful and important at the same time. Wonderful, because your extension has got the chance to be able to be used by users not speaking English. Important, because it tends to spread Joomla! 1.5 all over the world and provides weighty arguments for who hesitant in upgrading.
Why .ini instead of the .php format?
The Joomla! 1.5 framework is famous for the MVC design pattern what makes the authors to develop their extensions much more easier. So, instead of the PHP constants the JText class was introduced and it provides some benefits. The most important one is that you needn't create language definitions with underscores (_), e.g.:
<?php echo _EMPTY_CATEGORY; ?>
Replace this line with the following snippet:
<?php echo JText::_('Empty Category'); ?>
The above example is good for the short strings. When you have a text with multiple sentences then you can add a definition, but embed it in a JText call:
<?php echo JText::_('INSTALL_3PD_WARN'); ?>
Please note that in this case you should add the corresponding text to the appropriate language file.
Find the Bugs in the Language
Debug Language option When using Joomla! 1.5 you surely found the Debug Language option on the System tab of the Global Configuration screen. When a string is not available in any of the language files, then it will be closed between question marks (?...?). This way you or even a user easily can find and check the untranslatable strings. Well, only the MVC/JText extensions have the chance to be debugged by enabling this option.
Automated Language File Creation
JoomSuite Language component (JSL), a freely available third party tool, parses the .php and .xml files of a selected component and creates the appropriate .ini files both for the back-end and the front-end interfaces. It is worth to play with it and check out whether how many strings remained untranslatable. It's drawback that JSL can be used only for the components, however, you will like it, because it will save you some time when you prepare the next release of your extension.
In the era of the 'Do-It-Yourself' localization the .ini structure language files are widely used. I was glad to see this type of file in the Joomla! project because it is supported by both professional and open source CAT tools, and thanks to Ifan Evans, a must have native Joomla! 1.5 component is also available.


2008-10-13 20:39:41