EAF 7.6 Implementation

org.enhydra.i18n
Class ResManager

java.lang.Object
  extended by org.enhydra.i18n.ResManager

public class ResManager
extends java.lang.Object

Some helper functions for handeling i18n issues. One instance of this class should be created for each resource bundle.

The ResManager is created by a call to getResourceManager() the parameter is the name of the package that contails the Res class. e.g. ResManager rez = getResourceBundle("org.enhydra.mypackagename");

To use the ResManager make a call to any of the format() methods. In the default resource bundle the key is the same as the value. So to display "I am 2 years old" call rez.format("I am {0} years old",2); If the string "I am {0} years old" is in the bundle the value is returned. If string is not found in the bundle the key is returned and an error is logged to I18N_DEBUG. To see these errors add DEBUG_I18N to Server.LogToFile[] and Server.LogToStderr[] in multiserver.conf.

Author:
Peter Johnson

Method Summary
 java.lang.String format(java.lang.String key)
          Returns a string that has been obtained from the resource manager
 java.lang.String format(java.lang.String pattern, java.lang.Object o0)
          Returns a string that has been obtained from the resource manager then formatted using the passed parameters.
 java.lang.String format(java.lang.String pattern, java.lang.Object o0, java.lang.Object o1)
          Returns a string that has been obtained from the resource manager then formatted using the passed parameters.
 java.lang.String format(java.lang.String pattern, java.lang.Object o0, java.lang.Object o1, java.lang.Object o2)
          Returns a string that has been obtained from the resource manager then formatted using the passed parameters.
 java.lang.String format(java.lang.String pattern, java.lang.Object o0, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)
          Returns a string that has been obtained from the resource manager then formatted using the passed parameters.
static ResManager getResManager(java.lang.Class clazz)
          Returns a resource manager assocated with the package name.
static ResManager getResManager(java.lang.String packageName)
          Returns a resource manager assocated with the package name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getResManager

public static ResManager getResManager(java.lang.Class clazz)
Returns a resource manager assocated with the package name. An instance of the Res class is created the first time the method is called.

Parameters:
clazz - A class from the package that Rez is in.

getResManager

public static ResManager getResManager(java.lang.String packageName)
Returns a resource manager assocated with the package name. An instance of the Res class is created the first time the method is called.

Parameters:
packageName - The package name that holds the Res class

format

public java.lang.String format(java.lang.String key)
Returns a string that has been obtained from the resource manager

Parameters:
key - The string that is the key to the translated message

format

public java.lang.String format(java.lang.String pattern,
                               java.lang.Object o0)
Returns a string that has been obtained from the resource manager then formatted using the passed parameters.

Parameters:
key - The string that is the key to the translated message
o0 - The param passed to format replaces {0}

format

public java.lang.String format(java.lang.String pattern,
                               java.lang.Object o0,
                               java.lang.Object o1)
Returns a string that has been obtained from the resource manager then formatted using the passed parameters.

Parameters:
key - The string that is the key to the translated message
o0 - The param passed to format replaces {0}
o1 - The param passed to format replaces {1}

format

public java.lang.String format(java.lang.String pattern,
                               java.lang.Object o0,
                               java.lang.Object o1,
                               java.lang.Object o2)
Returns a string that has been obtained from the resource manager then formatted using the passed parameters.

Parameters:
key - The string that is the key to the translated message
o0 - The param passed to format replaces {0}
o1 - The param passed to format replaces {1}
o2 - The param passed to format replaces {2}

format

public java.lang.String format(java.lang.String pattern,
                               java.lang.Object o0,
                               java.lang.Object o1,
                               java.lang.Object o2,
                               java.lang.Object o3)
Returns a string that has been obtained from the resource manager then formatted using the passed parameters.

Parameters:
key - The string that is the key to the translated message
o0 - The param passed to format replaces {0}
o1 - The param passed to format replaces {1}
o2 - The param passed to format replaces {2}
o3 - The param passed to format replaces {3}

EAF 7.6 Implementation