| java.lang.Object org.enhydra.i18n.ResManager
ResManager | public class ResManager (Code) | | 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 | |
public String | format(String key) | public String | format(String pattern, Object o0) Returns a string that has been obtained from the resource manager then
formatted using the passed parameters. | public String | format(String pattern, Object o0, Object o1) Returns a string that has been obtained from the resource manager then
formatted using the passed parameters. | public String | format(String pattern, Object o0, Object o1, Object o2) Returns a string that has been obtained from the resource manager then
formatted using the passed parameters. | public String | format(String pattern, Object o0, Object o1, Object o2, Object o3) Returns a string that has been obtained from the resource manager then
formatted using the passed parameters. | public static ResManager | getResManager(Class clazz) Returns a resource manager assocated with the package name. | public static ResManager | getResManager(String packageName) Returns a resource manager assocated with the package name. |
format | public String format(String key)(Code) | | 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 String format(String pattern, Object o0)(Code) | | 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 Parameters: o0 - The param passed to format replaces {0} |
format | public String format(String pattern, Object o0, Object o1)(Code) | | 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 Parameters: o0 - The param passed to format replaces {0} Parameters: o1 - The param passed to format replaces {1} |
format | public String format(String pattern, Object o0, Object o1, Object o2)(Code) | | 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 Parameters: o0 - The param passed to format replaces {0} Parameters: o1 - The param passed to format replaces {1} Parameters: o2 - The param passed to format replaces {2} |
format | public String format(String pattern, Object o0, Object o1, Object o2, Object o3)(Code) | | 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 Parameters: o0 - The param passed to format replaces {0} Parameters: o1 - The param passed to format replaces {1} Parameters: o2 - The param passed to format replaces {2} Parameters: o3 - The param passed to format replaces {3} |
getResManager | public static ResManager getResManager(Class clazz)(Code) | | 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(String packageName)(Code) | | 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 |
|
|