Class LocalizedStringsSet

java.lang.Object
org.faktorips.datatype.util.LocalizedStringsSet

public class LocalizedStringsSet extends Object
A LocalizedStringsSet is a set of strings available in different locales. A localized string can be looked up by a locale independent key and a locale.

The locale dependent strings have to be stored in property files. They are accessed via Java's ResourceBundle. To access the property files, they all have to be in the same package and must start with the same prefix. Therefore the set's qualified name is the package name, followed by a dot (.), followed by the prefix, e.g. "org.faktorips.fl.Messages". For further information see the ResourceBundle documentation.

If a localized String contains sections that have to be replaced with locale dependent replacements before the String is presented to a user, you can use one of the methods taking replacement objects as a parameter. The mechanism used here is the one of MessageFormat.

Example:

In the message "The sum insured must be at least {0}." the sum insured must be inserted at runtime depending on the chosen product.

  • Constructor Details

    • LocalizedStringsSet

      public LocalizedStringsSet(Class<?> clazz)
      Creates a new set that uses the indicated class' name as qualified name.
      Throws:
      IllegalArgumentException - if the clazz is null.
    • LocalizedStringsSet

      public LocalizedStringsSet(String qualifiedName, ClassLoader loader)
      Creates a new StringsSet with the indicated qualified name. The property files are loaded with the indicated classloader.
      Throws:
      IllegalArgumentException - if the qualifiedName is null.
  • Method Details