Package org.globus.util
Class I18n
java.lang.Object
org.globus.util.I18n
An utility class for internationalized message handling.
Example usage::
private static I18n i18n = I18n.getI18n("org.globus.resource"); ... public void hello() { String filename = "file1"; String msg = i18n.getMessage("noFile", new String[]{filename}); ... }
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ClassLoader
static I18n
Retrieve a I18n instance by resource name.static I18n
getI18n
(String resource, ClassLoader loader) Retrieve a I18n instance by resource namegetMessage
(String key) Gets a message from resource bundle.getMessage
(String key, Object arg) Gets a formatted message from resource bundlegetMessage
(String key, Object[] vars) Gets a formatted message from resource bundle
-
Field Details
-
mapping
-
messages
-
-
Constructor Details
-
I18n
-
-
Method Details
-
getI18n
Retrieve a I18n instance by resource name.- Parameters:
resource
- resource name. SeeResourceBundle.getBundle()
-
getI18n
Retrieve a I18n instance by resource name- Parameters:
resource
- resource name. SeeResourceBundle.getBundle()
loader
- the class loader to be used to load the resource. This parameter is only used initially to load the actual resource. Once the resource is loaded, this argument is ignored.
-
getClassLoader
-
getMessage
Gets a message from resource bundle.- Throws:
MissingResourceException
-
getMessage
Gets a formatted message from resource bundle- Throws:
MissingResourceException
-
getMessage
Gets a formatted message from resource bundle- Throws:
MissingResourceException
-