Search


Creating a component Language Pack

This article describes a couple of methods for creating a language translation for a Joomla! extension, in this case Macrotone's Issue Tracker.

Transifex

One method that we have recently decided to make use of is the ‘Transifex’ project. To be truly multi-lingual most freely available Joomla component (including modules and plugins) relies on local communities to create language packs.  We realise that is can be a very dirty job, that is very time consuming.  Transifex provides a mechanism to make language translations faster but with less work. Making use of this mechanism we hope to be able to provide users with a wider variety of available languages ready to download.

Looking at the number of existing components already making use of Transifex, we are joining an already varied and wide ranging community.

Transifex comes with the options of a client or a web interface and also has an extensive help system.

One site that might provide useful to translators starting to get to grips with Transifex and its usage is provided here. Not being multilingual ourselves we cannot really make any valid comments upon how useful they specifically are, but they certainly appear to be informative and complete.

Basically the language files are placed upon the Transifex server by ourselves within a 'project' i.e 'Issue Tracker'. The translators have an account (free upon request) on Transifex and request access to a language, which if granted allows access to the specific language files. The translators can edit the language strings for their specific language directly online, or via the use of a 'Transifex client' (freely downloadable) download the files, perform the translation loacally and then upload them back to the Transifex server.

On our end we are kept informed of the state of translations automatically and via the use of a Joomla component named CTransifex (Compojoom) which can automatically generate the required installable zip files and make them available for users to download.

This avoids the need to create multiple zip files manually making the distibution task much simpler and relieving the translators from the tedious task of maintaining zip files, and at the same time providing an easier translation tool.

 Manual method

For those unwilling or unable to make use of Transifex, we here describe a manual mechanism for creating an installable extemsion pack.  For translating extensions for Joomla! 1.6, 1.7, 2.5 see this article: Creating language packs for extensions in Joomla 1.6/1.7  http://docs.joomla.org/Creating_language_packs_for_extensions_in_Joomla_1.6/1.7

For an example we will illustrate the build of the Portuguese Brazilian language for the Macrotone Issue Tracker component.

1) We will prepare folder structure for the new created translation. Create the following folders on your disc:

    lang/admin
    lang/site

Open text editor and paste the the following content:

     <html><body bgcolor="#FFFFFF"></body></html>

Save it as index.html in all folders (as lang/admin/index.html, lang/site/index.html and lang/index.html).

2) Unzip the Macrotone Issue Tracker component ZIP file somewhere on your disc. Go to:

    admin/language/en-GB/ folder (which is included in the unzipped Macrotone Issue Tracker structure)

and open both files:

    en-GB.com_issuetracker.ini
    en-GB.com_issuetracker.sys.ini

in your text editor. Translate the strings to your language and save them as (in our example we use Portuguese Brazilian prefixes):

    lang/admin/pt-BR.com_issuetracker.ini
    lang/admin/pt-BR.com_issuetracker.sys.ini

Go to:

    site/language/en-GB/ folder (which is included in the unzipped Macrotone Issue Tracker structure)

and open the file:

    en-GB.com_issuetracker.ini

in text editor. Translate the strings to your language and save it as (in our example we use Portuguese Brazilian prefixes):


    lang/site/pt-BR.com_issuetracker.ini

Files should be saved as UTF-8 without BOM encoding.

3) Open text editor and paste there the following content:

<?xml version="1.0" encoding="UTF-8"?>
<extension type="file" version="2.5" method="upgrade">
    <name>pt-BR.com_issuetracker</name>
    <tag>pt-BR</tag>
<version>1.1.0</version>
    <creationDate>01/04/2012</creationDate>
    <author>Macrotone Consulting Ltd</author>
    <authorEmail>

This email address is being protected from spambots. You need JavaScript enabled to view it.
</authorEmail>
    <authorUrl>http://www.macrotoneconsulting.co.uk</authorUrl>
    <copyright>(C) 2012 Macrotone Consulting Ltd</copyright>
    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
    <description>Brazilian-Portuguese language pack for Macrotone Issue Tracker</description>

    <fileset>
       <files folder="admin" target="administrator/language/pt-BR">
          <filename>pt-BR.com_issuetracker.ini</filename>
          <filename>pt-BR.com_issuetracker.sys.ini</filename>        
          <filename>index.html</filename>
       </files>
 
       <files folder="site" target="language/pt-BR">
          <filename>pt-BR.com_issuetracker.ini</filename>        
          <filename>index.html</filename>
       </files>
    </fileset>
</extension>

Edit it, changing the language specifics and the author as required and save it as :

    lang/install.xml file.

So now you should have the following folder structure in the folder lang:

    install.xml
    index.html
    admin/index.html
    admin/pt-BR.com_issuetracker.ini
    admin/pt-BR.com_issuetracker.sys.ini
    site/index.html
    site/pt-BR.com_issuetracker.ini

Select all files included in lang folder and add them into ZIP file called lang-prefix-LANG-PREFIX.com_issuetracker.zip (in our example the file will have the following name: pt-BR.com_issuetracker.zip).

Now the translation is ready and can be installed via standard Joomla! installation procedure.

Remember that the Joomla Language core pack for your desired language must be installed otherwise the language installation will fail.

Notes

It is possible to expand upon the above so that all of the language translations for plugins and modules can also be included within the zip file. To do this just create the appropriate language translation files and add then into the directory structure at the appropriate place.

An example of this can be seen in some of the language translation available for the Issue Tracter component on this site. The pt-BR translation by Carlos Rodrigues de Souza is a very good example.

There is one thing to note regarding language translations for the Smart Search (finder) module. In Joomla 2.5 and Joomla 3.x it has been discovered that the Joomla Smart Search module has a specific requirement that the finder plugin has a name composed of the plugin itself.  This was discovered after Issue Tracker 1.3.2 was released and a work around was implemented to ensure workability. Subsequent to the release the 'undefined' requirement was determined and hence the work around is no longer required.  The problem is best described as Smart Search looking for a 'strange' named language file based upon the provided name of the plugin. In our case because the plugin was name 'Smart Search - Issue Tracker', the smart search module was looking for a file named 'en-GB.Smart Search - Issue Tracker.ini'. [The spaces in the file name are significant.] The contents of the file are not a problem, it being a simple copy of the standard named 'en-GB.plg_finder_issuetracker.ini' file, so no further translation is required.


What is allowed in .ini files

Comments are made by a leading ";"

The translated string must be enclosed by double quotes.

COM_ISSUETRACKER_SAMPLE_PARAMETER_FILE_NOT_WRITABLE="Can not make the parameter file writable"

Do not split translations into multiple lines (only first line will show up).

COM_ISSUETRACKER_SAMPLE_PARAMETER_FILE_NOT_WRITABLE="Can not make the
parameter file writable"

If you want a new line, write

<br />

i.e.

COM_ISSUETRACKER_SAMPLE_PARAMETER_FILE_NOT_WRITABLE="Can not make the <br /> parameter file writable"
[Note] Ensure your translations are valid XHTML 1.0

Not <br>, not <br/> - only <br /> is valid.

If unsure, please use the current markup method.


[Note] Note

Files must be saved in UTF-8.


[Tip] Tip

Take care when using Double Quotes (") in your translation, used incorrectly it will break the translation.

Under Joomla! trying to escape double quote in language files will cause issues with some php versions:


COM_ISSUETRACKER_STICKY="My great \" string which is broken"

 

The way to escape double quote is the following :

 

COM_ISSUETRACKER_STICKY="My great "_QQ_" string which is broken"

 

This may seem strange, but it's the only way to escape double quote under Joomla!

Leave your comments

Post comment as a guest

0 Character restriction
Your text should be more than 25 characters
Your comments are subjected to administrator's moderation.
terms and condition.
  • No comments found

Additional information

The Macrotone Consulting Web site would like to use cookies to store information on your computer, to improve our website. Cookies used for the essential operation of the site have already been set. To find out more about the cookies we use and how to delete them, see our Privacy Policy.

I accept cookies from this site.