Tuesday, 16 June 2009

Localising the Website Title

Although my colleagues will probably want 'Digital Variants' in all languages, I wanted localised versions in French, Spanish and Italian as the website title. Here's how you do it. In default-page.psml add some meta-data for each desired version:

<metadata name="short-title" xml:lang="fr">Variantes Numériques</metadata>
etc.
Then, define a Velocity macro in decorator-macros.vm:
#macro (ShortPageTitle)$jetspeed.page.getShortTitle( $preferedLocale)#end
This calls the getShortTitle method of org.apache.jetspeed.page.document.Node.java, which retrieves the declared 'shortTitle' of the page. I now have 'Varianti Digitali' as the website title in Italian.

No comments:

Post a Comment