org.apache.xalan.res
Class XSLMessages

java.lang.Object
  extended byorg.apache.xalan.res.XSLMessages

public class XSLMessages
extends Object

Sets things up for issuing error messages. This class is misnamed, and should be called XalanMessages, or some such.


Field Summary
private static String BAD_CODE
          String to use if a bad message code is used.
private  Locale fLocale
          The local object to use.
private static String FORMAT_FAILED
          String to use if the message format operation failed.
private static String XPATH_ERROR_RESOURCES
          The class name of the XPath error message string table.
private static ListResourceBundle XPATHBundle
          The language specific resource object for XPath messages.
private static String XSLT_ERROR_RESOURCES
          The class name of the Xalan error message string table.
private static ListResourceBundle XSLTBundle
          The language specific resource object for Xalan messages.
 
Constructor Summary
XSLMessages()
           
 
Method Summary
static String createMessage(String msgKey, Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
static String createMsg(ListResourceBundle fResourceBundle, String msgKey, Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
static String createWarning(String msgKey, Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
static String createXPATHMessage(String msgKey, Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
static String createXPATHMsg(ListResourceBundle fResourceBundle, String msgKey, Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
static String createXPATHWarning(String msgKey, Object[] args)
          Creates a message from the specified key and replacement arguments, localized to the given locale.
 Locale getLocale()
          Get the Locale object that is being used.
private static String getResourceSuffix(Locale locale)
          Return the resource file suffic for the indicated locale For most locales, this will be based the language code.
static ListResourceBundle loadResourceBundle(String className)
          Return a named ResourceBundle for a particular locale.
 void setLocale(Locale locale)
          Set the Locale object to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLocale

private Locale fLocale
The local object to use.


XSLTBundle

private static ListResourceBundle XSLTBundle
The language specific resource object for Xalan messages.


XPATHBundle

private static ListResourceBundle XPATHBundle
The language specific resource object for XPath messages.


XSLT_ERROR_RESOURCES

private static final String XSLT_ERROR_RESOURCES
The class name of the Xalan error message string table.

See Also:
Constant Field Values

XPATH_ERROR_RESOURCES

private static final String XPATH_ERROR_RESOURCES
The class name of the XPath error message string table.

See Also:
Constant Field Values

BAD_CODE

private static String BAD_CODE
String to use if a bad message code is used.


FORMAT_FAILED

private static String FORMAT_FAILED
String to use if the message format operation failed.

Constructor Detail

XSLMessages

public XSLMessages()
Method Detail

setLocale

public void setLocale(Locale locale)
Set the Locale object to use.

Parameters:
locale - non-null reference to Locale object.

getLocale

public Locale getLocale()
Get the Locale object that is being used.

Returns:
non-null reference to Locale object.

createXPATHWarning

public static final String createXPATHWarning(String msgKey,
                                              Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
msgKey - The key for the message text.
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted warning string.

createXPATHMessage

public static final String createXPATHMessage(String msgKey,
                                              Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted message string.

createXPATHMsg

public static final String createXPATHMsg(ListResourceBundle fResourceBundle,
                                          String msgKey,
                                          Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
fResourceBundle - The resource bundle to use.
msgKey - The message key to use.
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted message string.

createMessage

public static final String createMessage(String msgKey,
                                         Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted message string.

createWarning

public static final String createWarning(String msgKey,
                                         Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
msgKey - The key for the message text.
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted warning string.

createMsg

public static final String createMsg(ListResourceBundle fResourceBundle,
                                     String msgKey,
                                     Object[] args)
Creates a message from the specified key and replacement arguments, localized to the given locale.

Parameters:
fResourceBundle - The resource bundle to use.
msgKey - The message key to use.
args - The arguments to be used as replacement text in the message created.
Returns:
The formatted message string.

loadResourceBundle

public static final ListResourceBundle loadResourceBundle(String className)
                                                   throws MissingResourceException
Return a named ResourceBundle for a particular locale. This method mimics the behavior of ResourceBundle.getBundle().

Parameters:
className - The class name of the resource bundle.
Returns:
the ResourceBundle
Throws:
MissingResourceException

getResourceSuffix

private static final String getResourceSuffix(Locale locale)
Return the resource file suffic for the indicated locale For most locales, this will be based the language code. However for Chinese, we do distinguish between Taiwan and PRC

Parameters:
locale - the locale
Returns:
an String suffix which can be appended to a resource name