FileDocCategorySizeDatePackage
LocalStringsManager.javaAPI DocGlassfish v2 API3963Fri May 04 22:32:42 BST 2007org.apache.tools.ant.taskdefs.optional.sun.appserv

LocalStringsManager

public class LocalStringsManager extends Object
This is a utility class for getting localized string. Strings are stored in a single property file per package named LocalStrings[_locale].properties.

Fields Summary
private String
packageName
private String
propertyFile
private ResourceBundle
resourceBundle
Constructors Summary
public LocalStringsManager()
Creates a new instance of LocalStringsManager



           
     
    
        this.resourceBundle = ResourceBundle.getBundle(packageName + "." + propertyFile);
    
Methods Summary
public java.lang.StringgetPackageName()

        return packageName;
    
public java.lang.StringgetPropertiesFile()

        return propertyFile;
    
public java.lang.StringgetString(java.lang.String key)

        String value = "";
        try
        {
            value = resourceBundle.getString(key);
        }
        catch (MissingResourceException mre)
        {
            // if not found, try next resource bundle in the iterator
        }
        return value;
    
public java.lang.StringgetString(java.lang.String key, java.lang.Object[] toInsert)

        String fmtStr = "";
        try
        {
            MessageFormat msgFormat = 
                            new MessageFormat(getString(key));
            fmtStr = msgFormat.format(toInsert);
        }
        catch(Exception e)
        {
        }
        return fmtStr;