Java Resource Bundles

Passolo can identify and process both ListResourceBundles and ArrayResourceBundles.

In this context, Passolo takes the class structure into account as well as the name of the base class, which normally should be ListResourceBundle or ArrayResourceBundle. To enable processing of ResourceBundles derived from other base classes, the settings for the Java add-in allow the definition of additional base classes.

As with property files, the Java source files can be stored in ANSI or UNICODE format, and will be generated in the same format after translation, using the target codepage where appropriate. Compiled ResourceBundles, on the other hand, are always encoded in UNICODE.

Another important difference between source text resources and compiled ResourceBundles has to do with code optimization, which can have an effect on the localization. If the following source file is localized with Passolo, both entries can be edited and translated - even with different translations.

import java.util.ListResourceBundle; 

  public class Passolo extends ListResourceBundle {

  static final Object[][] resources =

  {

    {"SEARCH_COMMAND", "Search"},

    {"FIND_COMMAND", "Search"}

  }; 

  public Object[][] getContents()

  {

    return resources;

  }

}

The compiled version of this class, on the other hand, contains only one occurrence of the "Search" string since the code optimizer will include only one of the two identical string constants. As a result, Passolo can only display a single line and the two strings have to be translated identically.