Localization Guide

This document defines the steps for localizing each internationalized section of a given Red Hat Web Application Framework installation.

Though straightforward, the current localization process does require a developer's involvement. The process will be enhanced in the future to relax that requirement, making it possible for non-technical staff to localize Red Hat Web Application Framework.

Standard UI

Red Hat Web Application Framework ships with a number of standard pages (for example, a pageflow for site visitors to become registered members), each of which can be localized (either currently or in a future release).

Login/Registration Pages

Assuming that $CCM_HOME points to the top-level directory of your checkout of the Red Hat Web Application Framework/CMS source tree, the $CCM_HOME/examples/localization-demo/ directory contains an example "localization pack" for the login/registration pages, which can be used as a template for real localizations. It contains four files:

  1. etc/resources/com/arsdigita/ui/login/SubsiteResources_de.properties: The skeleton of a German localization of the message keys used in the Bebop widgets that appear on the login/registration pages. Simply translate the values of each key in this file into the target language. The build system will copy this file to ${j2ee.webapp.dir}/WEB-INF/resources/com/arsdigita/ui/login/ directory, and (assuming that ${j2ee.webapp.dir}/WEB-INF/resources is in your classpath) Java will find it automatically.

    Note: There is special significance to the naming of this file. Java's built-in mechanism for finding resource bundles in the filesystem requires the "_<ISO language abbreviation>[_<ISO variant abbreviation>].properties" naming convention, and Red Hat Web Application Framework currently requires that the prefix of the filename be derived from the name of the package-specific Dispatcher Java class by replacing "Dispatcher" with "Resources", for example, the dispatcher for the login/registration pages is SubsiteDispatcher, and all corresponding properties files must be named in accordance with the "SubsiteResources_<ISO language abbreviation>[_<ISO variant abbreviation>].properties" pattern.

  2. xsl/login_de.xsl: The skeleton of a German localization (hence, the "de" in the filename) of the XSL stylesheet used by the login/registration pages. Simply translate the text within <xsl:template> elements into the target language, which, in this case, would be German.

    Note: Unlike the properties file mentioned above, there is no special convention for naming the stylesheet, since it is associated explicitly in the Initializer code; see below. That said, it makes sense to follow the convention of "login_<ISO language abbreviation>.xsl" implicitly established by the "login_de.xsl" file.

  3. src/Initializer.java: Defines the com.arsdigita.localization.demo.Initializer class, whose startup() method explicitly creates the association between the "acs-subsite" PackageType domain object (which represents the Red Hat Web Application Framework package type that contains the login/registration pages) and the above stylesheet—specified as a relative path from ${j2ee.webapp.dir} (where ${j2ee.webapp.dir} is the directory in which your Red Hat Web Application Framework web application is deployed), that is, "/packages/localization-demo/xsl/login_de.xsl" in this case—if that association does not already exist.

In order to create a localization, using the com.arsdigita.localization.demo package as a template, follow these steps:

  1. Make a copy of the $CCM_HOME/examples/localization-demo/ directory, and name it $CCM_HOME/localization-<ISO language abbreviation>/.

  2. If you are localizing to a language other than German, then rename etc/resources/com/arsdigita/ui/login/SubsiteResources_de.properties to etc/resources/com/arsdigita/ui/login/SubsiteResources_<ISO language abbreviation>.properties, for example, SubsiteResources_fr.properties for a French localization. Then, edit that file, replacing the values with appropriate translations of the default (English) values.

    If you're localizing to German, then you can simply edit the existing file.

  3. If you are localizing to a language other than German, then rename xsl/login_de.xsl to xsl/login_<ISO language abbreviation>.xsl, for example, login_fr.xsl for a French localization. Then, edit the stylesheet, specifically the default (English) text within each <xsl:template> element.

    If you're localizing to German, then you can simply edit the existing stylesheet.

  4. Edit the src/Initializer.java file in the following ways:

    • On line 16, change the package name from "com.arsdigita.localization.demo" to "com.arsdigita.localization.<ISO language abbreviation>".

    • On line 59, change the hardcoded value for the stylesheetPath variable from "/packages/localization-demo/xsl/login_de.xsl" to "/packages/localization-<ISO language abbreviation>/xsl/login_<ISO language abbreviation>.xsl", for example, for an actual German localization, the value would be "/packages/localization-de/xsl/login_de.xsl".

    • On line 86, change the first parameter of the call to subsitePackage.getStylesheets() from Locale.GERMAN to the appropriate locale (if needed).

    • On line 109, change the first parameter of the call to Stylesheet.createStylesheet() from Locale.GERMAN to the appropriate locale (if needed).

    • On lines 73 and 100, change the log message to reflect the appropriate locale (if needed).

  5. Edit the build.xml file:

    • Change the "name" attribute of the "<project>" element as you see fit.

    • Change the "value" attribute of the "app.name" property to "localization-<ISO language abbreviation>".

    • Change the "value" attribute of the "java.package.dir" property to "com.arsdigita.localization.<ISO language abbreviation>".

  6. Edit enterprise.init, adding a call to invoke com.arsdigita.localization.<ISO language abbreviation>.Initializer with no parameters (and remove the call to com.arsdigita.localization.demo.Initializer if you are providing a real German localization).

Administrative UI

Red Hat Web Application Framework also ships with a number of standard pages that are accessible only to users with administrative privilege (either site-wide administrators or individuals with a specific administrative privilege, for example, the moderator of a specific discussion forum), each of which can also be localized (either currently or in a future release).

User Administration UI

This section is not yet available.

Group Administration UI

This section is not yet available.

Site Map UI

This section is not yet available.

Permissions UI

This section is not yet available.