Internationalizing a Roller Weblogger based Blog

So I’ve been spending time lately providing better international support to the blog.

In fact check out the variants I’ve put together:

For the translator I used the Yahoo Babelfish translation service, rather than Google Translate (which I use to produce on demand translations of the site, at the time of posting this it should be at the top of the right hand sidebar), because I didn’t want to become tied in to a single Translation Service Supplier.

During translation I switched to using “blog” rather than “weblog” for the title, as many of the languages would translate blog but not weblog (possibly a weakness of the translation service).

I was alluding to the new multi-language pages and the new multi-lingual nature of the blog in the post on St. Patrick’s Day, however I’d only translated some of the posts, not internationalised the site itself, and so it wasn’t really time to go live, but I did want the posts to start being spidered (and the post “Weblog language translator – blog translation on the fly with Roller specific functionality” explains why).

iron l10n zion – or how I did it…

There are a number of ways to internationalize a blog running over Roller Weblogger, for instance at the Aquarium, another Sun Blog, they use multiple blogs instances, like the Japanese Aquarium, I didn’t go for this approach as I wanted to keep to a single blog instance (due to maintainability basically).

I approached the problem by having a language resource file which loads as the session begins based upon the locale determined in the URL.

At run time this is done dynamically like this:

  1. Decide which locale the user is loading the page from
  2. Load the language specific resource file / pack (from a repository of language resource files, of which there is one resource file / pack per language)
  3. Variables are already allocated and populated with language specific data
  4. Use the above variables throughout the Roller Weblogger template code (HTML mainly) to create the page
  5. Present the page to the user requesting it

A number of language resource files were needed, all of which I populated with text based named variables (obviously the name of the variable stays the same, just the content per language resource file is different).

Then I replaced all the specific uses of text across my roller templates with calls to those variables.

This is a code snippet example of the code which decides which language resource file to load, and yes, before you say it, it’s not aesthetically pleasing, but I’m the only person who’ll be debugging it, so I’ll let myself off on that one. As you can see it checks which locale the page is being called from (based on the URL, but you can’t see that bit), once it finds a positive it loads the language specific resource file (notice I also ensure to load a default at the end if a match can’t be found).

  #if ($model.locale == "en")

      #includeTemplate($model.weblog "_lang_en")

  #elseif ($model.locale == "zh")

      #includeTemplate($model.weblog "_lang_zh")


      #includeTemplate($model.weblog "_lang_en")


And here’s an example of a specific language resource file, in this case this is the start of “_lang_de”, one of the files that would have been loaded based on the logic in the above piece. As you can see it has my (string) variables allocated and populated.

  #set ($gtTitle = "Blog Wayne-Horkans: eklektisch")

  #set ($gtMostPopTags = "Die meisten populären Umbauten")

  #set ($gtSitePrefs = "Aufstellungsort-Präferenzen")

Here’s an example use of the $gtTitle (string) variable from above within the Roller Weblogger template, which Roller builds dynamically at run time, obviously if the page was being


Probably the worst part of this was being adversely effected by Roller timezone and localization sensitivity issues as documented in ROL-1337 “all components involved in weblog rendering need to be locale & timezone sensitive”.

For instance when generating blog specific URLs in my templates, not all of the Roller Weblogger functions, macros and variables are timezone / localisation safe, and so for a number of them I’ve had to step though the templates modding the code to be timezone and localization safe as I go.

This meant that I had to bodge parts of the code with temporary ‘fixes’ to make up for the incomplete coverage, but it will do for now.

A couple of the most obvious issues was one with dates, as “$utils.formatDate” only produces day and month names in English, and another with “$entry.permalink” as it produces a non-locale specific URL

  ## Replaced instances of $entry.permalink with $entryLSP (Locale Specific Permalink)

  #set ($entryLSP = 


I may also have to write alternate macros which are locale specific, including the one that generates a list of recent entries:

  #set ($rEntries = $model.weblog.getRecentWeblogEntries($chosenCat, $rEntriesTotal)) 

  ## Have to use this as locale settings don't yet effect "getRecentWeblogEntries"


I don’t want to give the impression that non of the Roller Weblogger timezone / locale specfic functionality works. In fact a lot more than I assumed would, did. Including the menu (content) functions and Tag URL functions, and I was very pleased that there was the level of support in Roller that there is for internationalization.

I’ll be providing more multi-lingual content, specifically the content rich, article like posts I’ve been doing, so far I’ve translated three posts of this ilk: