Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.i18n
Class ResManager  view ResManager download ResManager.java

java.lang.Object
  extended byorg.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.


Field Summary
private  java.util.ResourceBundle bundle
          The ResourceBundle for this locale.
private  java.lang.String bundleName
           
private static java.util.Hashtable bundles
           
private  com.lutris.logging.LogChannel logChannel
           
private  int logLevelDebug
           
private  int logLevelInfo
           
 
Constructor Summary
private ResManager(java.lang.String packageName)
           
 
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.
private  java.lang.String getString(java.lang.String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bundle

private java.util.ResourceBundle bundle
The ResourceBundle for this locale.


bundleName

private java.lang.String bundleName

logChannel

private com.lutris.logging.LogChannel logChannel

logLevelDebug

private int logLevelDebug

logLevelInfo

private int logLevelInfo

bundles

private static java.util.Hashtable bundles
Constructor Detail

ResManager

private ResManager(java.lang.String packageName)
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.


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.


getString

private java.lang.String getString(java.lang.String key)

format

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


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.


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.


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.


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.