FileDocCategorySizeDatePackage
Localizer.javaAPI DocGlassfish v2 API6358Fri May 04 22:32:52 BST 2007org.apache.jasper.compiler

Localizer

public class Localizer extends Object
Class responsible for converting error codes to corresponding localized error messages.
author
Jan Luehe

Fields Summary
private static final ResourceBundle
bundle
Constructors Summary
Methods Summary
public static java.lang.StringgetMessage(java.lang.String errCode)


    /*
     * Returns the localized error message corresponding to the given error
     * code.
     *
     * If the given error code is not defined in the resource bundle for
     * localized error messages, it is used as the error message.
     *
     * @param errCode Error code to localize
     * 
     * @return Localized error message
     */
         
	String errMsg = errCode;
	try {
	    errMsg = bundle.getString(errCode);
	} catch (MissingResourceException e) {
	}
	return errMsg;
    
public static java.lang.StringgetMessage(java.lang.String errCode, java.lang.String arg)

	return getMessage(errCode, new Object[] {arg});
    
public static java.lang.StringgetMessage(java.lang.String errCode, java.lang.String arg1, java.lang.String arg2)

	return getMessage(errCode, new Object[] {arg1, arg2});
    
public static java.lang.StringgetMessage(java.lang.String errCode, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)

	return getMessage(errCode, new Object[] {arg1, arg2, arg3});
    
public static java.lang.StringgetMessage(java.lang.String errCode, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4)

	return getMessage(errCode, new Object[] {arg1, arg2, arg3, arg4});
    
public static java.lang.StringgetMessage(java.lang.String errCode, java.lang.Object[] args)

	String errMsg = errCode;
	try {
	    errMsg = bundle.getString(errCode);
	    if (args != null) {
		MessageFormat formatter = new MessageFormat(errMsg);
		errMsg = formatter.format(args);
	    }
	} catch (MissingResourceException e) {
	}
	
	return errMsg;