Running the Platform in another language

These instructions show you how to setup an alternative locale environment and run the platform in it. They apply to other tools besides the platform as well, of course. In fact, these instructions are more pertinent to platform tools since the platform itself is somewhat isolated from locale changes on the host machine.

1. Setup a new locale on your machine

Instructions for setting up Japanese Shift_JIS charset on Ubuntu Linux:

  1. Install the language pack:
    $ sudo apt-get install language-pack-gnome-ja language-pack-ja
  2. List the currently installed locale's
    $ locale -a
  3. We need to add ja_JP.shiftjis to this list.
  4. List the available charsets
    $ locale -m
    You should see SHIFT_JIS in the list
  5. Compile the ja_JP.shiftjis locale
    $ sudo localedef -f SHIFT_JIS -i ja_JP ja_JP.Shift_JIS
  6. List the currently installed locales to see if our new one is now available
    $ locale -a

2. Test the new locale

  1. in a terminal set the locale
    $ export LANG=ja_JP.shiftjis
  2. configure your terminal to decode using the Shift_JIS charset
    In a Gnome terminal this can be done via the menu option: Terminal->Set Character Encoding->Japanese (SHIFT_JIS)
  3. run the date command to see if Japanese characters appear
    $ date
    2008? 11? 4? ??? 16:11:09 EST

3. Configure the Platform to use the locale

So far we have configured the host machine to run in a non-English locale. The platform is designed to not really care about the host machine's locale at all. It is configured independently through the web.xml. However, It is valuable to test the platform on various host locales to ensure that it runs correctly (we have seen problems in such cases).

You should be concerned with these three context-params:

<context-param>
  <param-name>locale-language</param-name>
  <!-- for example 'fr' for French, 'de' for German, da for danish -->
  <param-value>ja</param-value>
</context-param>

<context-param>
  <param-name>locale-country</param-name>
  <!-- for example 'FR' for France, 'CA' for Canada -->
  <param-value>JP</param-value>
</context-param>

<context-param>
  <param-name>encoding</param-name>
  <param-value>UTF-8</param-value>
</context-param>

Notice that we did not align the platform encoding (UTF-8) with that of the host (Shift_JIS). It is not necessary that they align since the platform will abide by it's own encoding setting. (Note: this is not 100% correct. There are bugs in the platform that break this design: BISERVER-2525)

4. Run the Platform in the new locale

  1. in a terminal set the locale
    $ export LANG=ja_JP.shiftjis
  2. configure your terminal to decode using the Shift_JIS charset (so you can see log messages in Japanese)
    In a Gnome terminal this can be done via the menu option: Terminal->Set Character Encoding->Japanese (SHIFT_JIS)
  3. start the platform
    $ start_pentaho.sh

5. Run your browser in an alternate language and charset

The platform is by default set to ignore the browser's character set and use the one set in web.xml, but again, it is good to test with various character sets to make sure everything works correctly. Here is how you would setup a Japanese/Shift_JIS Firefox 3.

..in Firefox:

  1. Set the preferred language:
    Edit->Preferences->Content->Languages
  2. Set the preferred encoding:
    View->Character Encoding->Japanese (Shift_JIS)

6. Running Java Swing apps in Japanese

Swing apps will not render East-asian or other non-latin character sets correctly unless you have setup the correct fonts in your JRE. Instead of having to modify font.properties files, you can use this simple workaround:

  1. cd to your jre/lib/fonts folder
  2. create a dir named "fallback" and cd into it (the JRE will look here before determining it cannot find a font)
  3. locate the system fonts you wish the JRE to know about. In Ubuntu 9.04 that location is /usr/share/fonts/truetype.
  4. create symlinks to those fonts in the fallback folder. For example ln -s /usr/share/fonts/truetype/ttf-japanese-mincho.ttf

References

http://www.linux.com/feature/53781
http://jody.sci.hokudai.ac.jp/~ike/colum/ubuntu_feisty_amd64.html
http://www.joelonsoftware.com/articles/Unicode.html
http://en.wikipedia.org/wiki/Shift-JIS