Class WrapperResources

java.lang.Object
org.tanukisoftware.wrapper.WrapperResources

public final class WrapperResources extends Object
A resource bundle which is used to help localize applications to the default locale of the JVM. Resources are stored in MO files using the standard UNIX gettext resources. For example,

WrapperResources res = WrapperManager.loadWrapperResources( "myapp", "../lang/" ); To use the WrapperResources, make a call to any of the getString() methods. If the resource files are not found, or the specific key is not found then the key is returned unmodified. All resource keys passed to getString() will be processed using the java.util.MessageFormat class. As such, single quotes must be escaped. This class can optionally validate all such keys and logs warnings about keys which fail these checks. It is possible to enable this validation with the following property. (Defaults to FALSE) -Dorg.tanukisoftware.wrapper.WrapperResources.validateResourceKeys=TRUE

Author:
Tanuki Software Development Team <support@tanukisoftware.com>
  • Constructor Details

    • WrapperResources

      protected WrapperResources()
      WrapperResources instances are created using the WrapperManager.loadWrapperResources method.
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • getString

      public String getString(String key)
      Request a localized version of the specified key.
      Parameters:
      key - Resource to be localized.
      Returns:
      The localized version of the key.
    • getString

      public String getString(String key, Object[] arguments)
      Request a localized version of the specified key.

      Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

      Parameters:
      key - Resource to be localized.
      arguments - An array of argumens to be replaced in the resource.
      Returns:
      The localized version of the key.
      See Also:
    • getString

      public String getString(String key, Object arg0)
      Request a localized version of the specified key.

      Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

      Parameters:
      key - Resource to be localized.
      arg0 - An argument to be replaced in the resource.
      Returns:
      The localized version of the key.
      See Also:
    • getString

      public String getString(String key, Object arg0, Object arg1)
      Request a localized version of the specified key.

      Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

      Parameters:
      key - Resource to be localized.
      arg0 - An argument to be replaced in the resource.
      arg1 - An argument to be replaced in the resource.
      Returns:
      The localized version of the key.
      See Also:
    • getString

      public String getString(String key, Object arg0, Object arg1, Object arg2)
      Request a localized version of the specified key.

      Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

      Parameters:
      key - Resource to be localized.
      arg0 - An argument to be replaced in the resource.
      arg1 - An argument to be replaced in the resource.
      arg2 - An argument to be replaced in the resource.
      Returns:
      The localized version of the key.
      See Also:
    • getString

      public String getString(String key, Object arg0, Object arg1, Object arg2, Object arg3)
      Request a localized version of the specified key.

      Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

      Parameters:
      key - Resource to be localized.
      arg0 - An argument to be replaced in the resource.
      arg1 - An argument to be replaced in the resource.
      arg2 - An argument to be replaced in the resource.
      arg3 - An argument to be replaced in the resource.
      Returns:
      The localized version of the key.
      See Also:
    • getString

      public String getString(String key, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
      Request a localized version of the specified key.

      Individual tokens will be replaced with the specified parameters using the Java MessageFormat format method.

      Parameters:
      key - Resource to be localized.
      arg0 - An argument to be replaced in the resource.
      arg1 - An argument to be replaced in the resource.
      arg2 - An argument to be replaced in the resource.
      arg3 - An argument to be replaced in the resource.
      arg4 - An argument to be replaced in the resource.
      Returns:
      The localized version of the key.
      See Also: