can you get more random?

Better l10n for Joomla

July 6th, 2014 Posted in geeky stuff, languages

For the past couple of weeks I’ve been working on a site developed in Joomla. This wasn’t by choice, but it was a good chance to learn more about the CMS. The site is available in three languages so the question of content translation quickly came up.

There are several Joomla Plugins for managing multi-lingual content available, but none of them fit our needs.

The current available plugins can be broadly classified in 2 groups :

  • Plugins like FaLang, jDiction which allow you to translate entire articles via a web interface. The problem with these plugins is that if an article contains html or javascript, this needs to copied into the translated version, thereby meaning 3 copies of code need to be managed,
  • Plugins like EasyLanguage and Multilanguages CK which allow you to tag strings for translation in templates, rather than translating entire files. However both these extensions require the translated text to be inserted directly into the source file.

I was looking for the following features :

  • ability to tag translatable strings, like Ruby’s <%=t :translate_me %>, Django’s {% trans “Translate me” %} or Symfony’s ,
  • an easy way to manage translation strings. to extract them for translation and integrate the translated text. My german isn’t up to the task, so someone else will be translating the site. I’ve got better things to do than cut-paste strings into a spreadsheet, then cut and paste the translations back.

Easylanguage seemed to be the most suitable (small codebase, well written, easy to understand code) so I spent a few hours yesterday adding my feature requests. It works in the following way :

  1. mark strings for translation in articles, categories, templates, menus, anywhere with the following syntax: {lang}translate me{/lang}. You can also leave the default easylanguage syntax: {lang fr}texte en français{/lang}{lang de}Satz in Deutsch{/lang} and this will be used if there is nothing in the translation file.
  2. Turn on automatic file creation.
  3. Browse your site – visit every page and the translation file is automatically created.
  4. Translate the strings in the file language/de-DE/de-DE.easylanguage.csv (or the intl of your choice)
  5. Turn off automatic file creation.
  6. That’s it.

You can download my updated version of the plugin here. It’s not prefect, but it suits my needs and it only took 2 hours. I’m posting this in the hope that it will be useful for someone else. If you have any comments or imporvements, let me know. Next feature request is the ability to manage the translation viles via the admin interface 😉

plg_system_easylanguageplus-1.0_j25_30

Share

Post a Comment