Specify Software Project Staff
01 June 2010
Version 1.0
Java has extensions for supporting internationalizing and localizing applications. Although there are various APIs that can be used within the application, the most important aspect of localizing an application is translating the text used in the the graphical user interface (GUI) into the proper locale. Java takes a simple but effective approach to this: it uses 'named value' pairs. The 'name' is a key that the software uses to look up a text string in the current locale that is to be displayed to the user. The challenge for the developers is to make sure that all strings in the application have to be changed to use a 'locale' look up. The name/value pairs are stored in a text 'properties' file for each language localization.
The majority of Java applications that require localization simply create and populate a properties file for each required language. This is fairly simple and straight forward. The real challenge for large software applications is not the initial effort of localization, but the ongoing maintenance of the software. As each new release is shipped small but important changes in the application will require named/values pairs to be added, removed or edited. Locating the changes in the properties file can be daunting without the support of utility applications.
Specify 6 has three different areas that need to be localized:
This section provides a small overview of how the java properties file work. As mentioned earlier, Java localizations are stored in text files 'properties'. A Java application can have a default localization.
The Trifocal provides two import tasks:
When the application starts for the first time it will ask the user to choose a new localization. It will then create a new directory named 'I18N' in the user's 'My Documents' directory ('Documents' for the Mac, and at the root user directory for Linux). It then copies the original English files to and directory named 'en' and also creates a directory for the new localization (e.g. for Spanish it would be 'es'). Although the files in the localized directory can be edited with a text editor it is not recommended.
Specify requires that several files be localized SpecifyL10N will assist the user and managing all the files.
The following screen shot shows the main window of the SpecifyL10N. This a list of descriptions for each part of the screen that match the green numbers in the screen shot.

The entire list of keys that need to be translated will appear in #1. Item #2 shows the list of new or changed items to be translated. The first time a file is opened for translation the two lists will be identical. The English string will be displayed in the text box #4 and the new translated text will be entered in text box #5. The 'Translate' button can be used to perform a quick translation using the Google Translate web service. Although the auto translations can seldom be used 'as-is,' it can save on typing.
As discussed earlier, Java properties files are 'name/value' pairs. This means that both the 'key' and the 'value' must both be stored on a single line in the file and therefore cannot contain any 'returns' or 'linefeeds.' If the 'value' portion of the text is too long and requires a new line the characters '\n' will be used. As each piece of text is translated it is important to note if the English version contains any '\n' characters. If so, you should place the '\n' in your translated text to approximate the same length of each line. In some cases, if the string is not 'broken up' using the '\n' then a dialog or label maybe appear too wide for the screen. Here is an example:
There was an error unlocking the form.\nYou may need to unlock the associated tree, if there is one.
Formatting
Some 'value' strings in the English translation contain addition special character sequences like: '%s' or '%d'
These strings are parameterized format strings, or in other words, the special characters sequence is replaced by a string or a number before the string is displayed. These must be left in and at the proper location to provide the intended information to the user. Here is an actual example:
The data in the field '%s' exceeds %d characters.
HTML
Some strings use HTML markup for their messages. It is important to leave in the HTML markup for the message to display correctly.
<html><i>(You may wish to place an '*' before or after the word(s), for a wild card search.)


The dialog shown above lists the available files that are to be translated. It is not a typical file chooser dialog.
Most of the fields in the forms get their labels from the schema in the database. The Schema Config tool is used to localize the labels and the descriptions. There are a hand full of forms with fields that get their labels though the Java properties mechanism.
(Coming Soon)