How can I create a language-pack for MageBridge?
If you want to create a language-pack, the best thing is to copy the English language-files and translate them. There are two separate language-packs you need to create: One for the frontend and one for the backend. The frontend only needs one language-file: language/en-GB/en-GB.com_magebridge.ini. For the backend two language-files are used: administrator/language/en-GB/en-GB.com_magebridge.ini and administrator/language/en-GB/en-GB.com_magebridge.menu.ini. The last file only includes the translation of the menu-item, so could be skipped.
Locale
When copying the files you need to find out your locale and the Joomla! notation for it. For British English this is en-GB, but other locales include de-DE (Deutsch or German), fr-FR (French) and nl-NL (Dutch). If you don't know the name of your locale, remember that you need a global Joomla! language-pack to translate MageBridge. The MageBridge language-pack uses the same locale-name as the Joomla! language-pack.
Setup for the frontend
First we are going to create the language-pack for the Joomla! frontend (site). Create a temporary directory which follows the following naming standard: lang_xx-XX.com_magebridge-site where xx-XX stands for your locale-name. Then copy the file language/en-GB/en-GB.com_magebridge.ini to your own language-file xx-XX.com_magebridge.ini within that temporary directory.
Translating the frontend
Now we can start editing our own language-file. Language-files follow a very basic INI-format that looks the following:
MY TRANSLATION=Mijn vertalingThe original English version is found on the left, while the translation follows on the right (Dutch in this case). The original text on the left is case-insensitive, and the standard is to use capital letters here. The translated text on the right could be anything you want.
Sometimes you will see a notation like this:
ERROR SAVING=Probleem met het opslaan van %sThe text %s is a variable which is replaced by the Joomla! language-system with some value. To make this variable appear in your own translation, make use of those indicators %s (for a text) or %d (for a number). Note that this indicator is sometimes present in the original English version, but sometimes isn't. Make sure you always leave the original version intact.
ITEMS SAVED=%d artikelen opgeslagen
ITEM %s IS LOCKED=Het artikel '%s' is bezet
If some entries are missing in the English language-file, no worries. Go to your Joomla! Administrator, open up the Global Configuration and click on the System tab. On the right you will find an option called Debug Language.
Turning this on will outline all untranslated text with questionmarks. Make sure you browse the frontend in the right language. For example, if the text "MY DESCRIPTION" is not yet translated, it will appear like this:
??MY DESCRIPTION??
This requires a new line in your translation:
MY DESCRIPTION=Mijn omschrijving
XML installation file
Individual language-files could just be copied to the right location, but it's easier to create an installable language-pack: A language-pack is basically a ZIP-file with the language-files needed plus a XML installation file. The temporary directory (created earlier) contains these files and is the base for the ZIP-file.
Copy the following XML-content to a file called install.xml within the temporary directory. Replace LANGUAGE with the name of the language you're creating (for instance: German or Persian). Again replace xx-XX with the actual locale-name. You can also change the following fields without a problem: version, creationDate, author, authorEmail, authorUrl, copyright, license, description. If you want you can also leave out the complete line.
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" client="site" type="language" method="upgrade">
<name>MageBridge - LANGUAGE</name>
<tag>xx-XX</tag>
<version>1.0</version>
<creationDate>2009-12-21</creationDate>
<author>Your Name</author>
<authorEmail>Your Email</authorEmail>
<authorUrl>Your Website</authorUrl>
<copyright>Your Copyright</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html</license>
<description>LANGUAGE translation of MageBridge (site)</description>
<files>
<filename>xx-XX.com_magebridge.ini</filename>
</files>
<params />
</install>
This XML also contains the string method="upgrade". Though not yet officially supported, this allows for the language-file to be reinstalled without having to uninstall it first.
Finishing up
By now, you should have a language-file called xx-XX.com_magebridge.ini and an installation-file called install.xml in a directory called lang_xx-XX.com_magebridge-site. Zip this directory into a ZIP-file called lang_xx-XX.com_magebridge-site.zip. In the end the ZIP should contain the following structure:
lang_xx-XX.com_magebridge-site
- xx-XX.com_magebridge.ini
- install.xml
That's it. The ZIP file could be uploaded and installed as a regular extension through the Joomla! Administrator Install / Uninstall page.
Translating the backend
The same applies to the backend. You'll need to create a separate language-pack for the backend with the following structure:
lang_xx-XX.com_magebridge-adminAll the steps above still apply. Just replace all instances of "site" with "admin".
- xx-XX.com_magebridge.ini
- xx-XX.com_magebridge.menu.ini
- install.xml
Translating other MageBridge extensions
If you want to translate a module, just replace com_magebridge in all file-notations above with mod_magebridge_XYZ where XYZ stands for the specific module-name. The same applies to translating plugins.
About this procedure
This procedure for creating a language-pack follows the general guidelines of the Joomla! project. All steps could be applied to any extension that follows the Joomla! translation-system. Only the naming of the ZIP-file could differ.
Created on Tuesday, 23 June 2009Modified on Sunday, 06 December 2009
More tutorials in this section
- MageBridge plugin events
- MageBridge from the command-line
- MageBridge FAQ: Development
- Reusing MageBridge parameters in Joomla! extensions
- Catching Magento events with a Joomla! plugin
- Fetch your own Magento data from MageBridge
- Handling events with MageBridge (in progress)
- How can I create a language-pack for MageBridge?
- Creating custom store connectors
- Discovering the MageBridge Magento package
