Modifying a Joomla! language pack
Joomla! 1.5 offers partial multi-linguality, meaning that the system language of Joomla! or its extensions can be translated, but if you want to translate your content, you'll need third party extensions like Joom!Fish or Nooku. If you want to modify the system language, you can edit the necessary files, but with the next Joomla! upgrade, your changes might be gone. So how to deal with this?
Language files in the Joomla! directory structure
With Joomla!, language-files are stored within the folder languages, and within that directory for each language a subdirectory is created. Within those subdirectories the language files are stored - so-called INI-files with language definitions. For instance, the English language-file for a component like SimpleLists, is located under the following file:
Within these INI-files the original untranslated word or sentence is listed on the left, while the translated version is listed on the right:
Now the English translation is not really interesting, but if we would have a Dutch translation for the same content (for instance placed in the file languages/nl-NL/nl-NL.com_simplelists.ini, it might look like the following:
Now, what if you want to change the text "Read more" into something else like "Continue reading". You might be tempted to change the original language-file straight away.
This works, but with the next upgrade (of the Joomla! core or of the Joomla! extension in question), all your changes are gone. Instead, you need some kind of workaround to make sure your copy of the language file is still used, regardless of future upgrades. Now, Joomla! offers templating, template overrides and other techniques, but unfortunately there is no solid solution for this problem.
Create your own language
The only workaround is to create simply a new language. I don't mean a completely new language (like Klingon, which is in fact already supported by Joomla!), but just a variation on the same language. The language code used in the example above was en-GB (Great Brittain) but there are different variations as well, for instance en-US (United States) and en-ZA (South Africa).
You can easily create your own language-variation by creating a new folder and placing the right files in there. For example, let's create a new language en-MY (which does not seem to be reserved). This means we need to create a new folder called languages/en-MY which needs to contain at least a XML-file, which makes this new language known to Joomla!:
It's of course easiest to take the original en-GB.xml and replace all occurrances of en-GB with en-MY.
The downside is that Joomla! does not offer a language-fallback. If your own language-folder is missing some language-file, there is no fallback to plain Englis, but instead the original untranslated string is shown (which looks kind of ugly).
So instead of worrying about overwriting modified versions of Joomla!, you'll need to worry about all the new files you have to maintain yourself. We highly recommend keeping your Joomla! installation up to date at all times, so you'll need to decicde yourself which method of modifying language-files is the most efficient.
Modified on Thursday, 08 November 2012
More tutorials in this section
- Joomla! 1.6 ACLs (1): Marketing group
- Load a module within your Joomla! articles
- Modifying a Joomla! language pack
- Redirect html-suffix in your URLs
- Video: Speed Up Joomla with mod_deflate
- Hiding PHP Notices in Joomla!
- So what's happening with Joomla! 1.6?
- Get rid of /index.php/ in your Joomla! URLs
- Redirecting all 404s to Joomla! properly
- Dealing with SSL mixed content in Joomla!
- Troubleshooting a blank page