Actions

How to distribute languages for native Joomla! 1.5 extensions

From Joomla! Documentation

Revision as of 05:00, 5 October 2010 by Batch1211 (Talk | contribs)

When you create a translation for a 3PD extension, usually it is included in the package, but sometimes it is distributed separately. In the 2nd case, it may be difficult to tell the user where to upload the language file(s), though it is even more simplier now than was in Joomla! 1.0.x.

To avoid this, by the analogy of the Joomla! 1.5 core languages you can create an installable language pack for a native Joomla! 1.5 extension. You will need to compress the .ini files and an install.xml file for them into a supported archive type with the following code like this for the back-end:

    <?xml version="1.0" encoding="utf-8"?>
    <install version="1.5" client="administrator" type="language" method="upgrade">
        <tag>xx-XX</tag>
        <version>1.0</version>
        <creationDate>YYYY-MM-DD</creationDate>
        <author>Your Name</author>
        <name>YourLanguage</name>
        <authorEmail>yourmail@example.com</authorEmail>
        <authorUrl>http://www.example.com/</authorUrl>
        <copyright>Copyright (C) YYYY Copyright Owner. All rights reserved.</copyright>
        <license>LicenseType</license>
        <description>[Language name] translation for [extension_name]</description>
        <files>
            <filename>xx-XX.[extension_name].ini</filename>
        </files>
      <params />
    </install>

It is recommended to add the method="upgrade" parameter in order to be able to easily install a new version of the language pack. It this parameter is not specified, the installer cannot overwrite the old language file(s) and it results an error.

When an extension has language file(s) for the front-end as well, an additional package should be created. In this case please change the following line of the install.xml file:

    <install version="1.5" client="administrator" type="language" method="upgrade">

to this:

    <install version="1.5" client="site" type="language" method="upgrade">

In Joomla! 1.5.4 was implemented the single installation of both admin and site language packs what makes the language packs management even more easier for the site administrators. You can create such language pack installer using the following template:

  <?xml version="1.0" encoding="utf-8"?>
  <install version="1.5" type="language" client="both" method="upgrade">
      <name>YourLanguage</name>
      <tag>xx-XX</tag>
      <version>1.0</version>
      <creationDate>YYYY-MM-DD</creationDate>
      <author>Your Name</author>
      <authorEmail>youremail@example.com</authorEmail>
      <authorUrl>http://www.yoursite.com/</authorUrl>
      <copyright>Copyright (C) YYYY Copyright Owner. All rights reserved.</copyright>
      <license>License Type</license>
      <description>[Language name] translation for [extension_name]</description>
      <administration>
        <files folder="admin">
          <filename>xx-XX.[extension_name].ini</filename>
        </files>
      </administration>
      <site>
        <files folder="site">
          <filename>xx-XX.[extension_name].ini</filename>
        </files>
      </site>
      <params />
  </install>

For such kind of language pack installers, you should create an "admin" folder and a "site" folder with the appropriate language files included and an install.xml file added up one level.

Due to the critical vulnerability fixed in Joomla! 1.5.6 it was mandatory to update a web site to this version, so the creation of a single installation pack should be preferred.

Such kind of language packs can be created for the native Joomla! 1.5 extensions developed using the MVC pattern only.

Such a language pack can be installed via the Install tab of the Extension Manager screen opened by the Extensions -> Install/Uninstall menu item. The included language file(s) will be uploaded to the appropriate folder.

For a translator, this method allows him/her to specify the authoring details what are rarely added to the header of a language file. This way the end user will know who to contact for occasional proof-reading or just for a thank you.

For a developer, there is no need to add a language installation feature for their extensions that was a feature for some 1.0.x extensions.