FileDocCategorySizeDatePackage
I18n.javaAPI DocJava SE 6 API7180Tue Jun 10 00:23:04 BST 2008com.sun.org.apache.xml.internal.security.utils

I18n

public class I18n extends Object
The Internationalization (I18N) pack.
author
Christian Geuer-Pollmann

Fields Summary
public static final String
NOT_INITIALIZED_MSG
Field NOT_INITIALIZED_MSG
private static String
defaultLanguageCode
Field defaultLanguageCode
private static String
defaultCountryCode
Field defaultCountryCode
private static ResourceBundle
resourceBundle
Field resourceBundle
private static boolean
alreadyInitialized
Field alreadyInitialized
private static String
_languageCode
Field _languageCode
private static String
_countryCode
Field _countryCode
Constructors Summary
private I18n()
Constructor I18n


         
     

      // we don't allow instantiation
   
Methods Summary
public static java.lang.StringgetExceptionMessage(java.lang.String msgID)
Method getExceptionMessage

param
msgID
return
message translated


      try {
         String s = resourceBundle.getString(msgID);

         return s;
      } catch (Throwable t) {
         if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
            return "No message with ID \"" + msgID
                   + "\" found in resource bundle \""
                   + Constants.exceptionMessagesResourceBundleBase + "\"";
         } 
         return I18n.NOT_INITIALIZED_MSG;
      }
   
public static java.lang.StringgetExceptionMessage(java.lang.String msgID, java.lang.Exception originalException)
Method getExceptionMessage

param
msgID
param
originalException
return
message translated


      try {
         Object exArgs[] = { originalException.getMessage() };
         String s = MessageFormat.format(resourceBundle.getString(msgID),
                                         exArgs);

         return s;
      } catch (Throwable t) {
         if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
            return "No message with ID \"" + msgID
                   + "\" found in resource bundle \""
                   + Constants.exceptionMessagesResourceBundleBase
                   + "\". Original Exception was a "
                   + originalException.getClass().getName() + " and message "
                   + originalException.getMessage();
         } 
          return I18n.NOT_INITIALIZED_MSG;
      }
   
public static java.lang.StringgetExceptionMessage(java.lang.String msgID, java.lang.Object[] exArgs)
Method getExceptionMessage

param
msgID
param
exArgs
return
message translated


      try {
         String s = MessageFormat.format(resourceBundle.getString(msgID),
                                         exArgs);

         return s;
      } catch (Throwable t) {
         if (com.sun.org.apache.xml.internal.security.Init.isInitialized()) {
            return "No message with ID \"" + msgID
                   + "\" found in resource bundle \""
                   + Constants.exceptionMessagesResourceBundleBase + "\"";
         } 
         return I18n.NOT_INITIALIZED_MSG;
      }
   
public static java.lang.Stringtranslate(java.lang.String message, java.lang.Object[] args)
Method translate translates a message ID into an internationalized String, see alse XMLSecurityException.getExceptionMEssage(). The strings are stored in the ResourceBundle, which is identified in exceptionMessagesResourceBundleBase

param
message
param
args is an Object[] array of strings which are inserted into the String which is retrieved from the ResouceBundle
return
message translated

      return getExceptionMessage(message, args);
   
public static java.lang.Stringtranslate(java.lang.String message)
Method translate translates a message ID into an internationalized String, see alse XMLSecurityException.getExceptionMEssage()

param
message
return
message translated

      return getExceptionMessage(message);