public abstract class I18nBase extends Object
ResourceBundle
Modifier | Constructor and Description |
---|---|
protected |
I18nBase(Class<?> resClass,
String resPrefix)
Constructs a new
I18nBase instance. |
Modifier and Type | Method and Description |
---|---|
protected void |
onFormatError(Throwable thrown,
String format,
Object... args)
Called when an error occurs formating an i18n message.
|
protected void |
onResourceNotFound(String key)
Called when a resource indexed by supplied key was not found.
|
protected void |
onSearchError(Throwable thrown,
String key)
Called when an error occurs searching for a resource with key.
|
String |
tr(String message,
Object... args)
Translates and formats a message using supplied optional arguments.
|
protected I18nBase(Class<?> resClass, String resPrefix)
I18nBase
instance. The resource bundles must be
located in the package of class resClass
. The resource bundles
are loaded using de default locale, and the class loader of class resClass
. The names of the resource bundles must start with the
specified resPrefix
.resClass
- the class reference used to load resources.resPrefix
- the prefix of all resource bundle names.NullPointerException
- if an argument is null
.ResourceBundle.getBundle(String, Locale, ClassLoader)
protected void onResourceNotFound(String key)
key
- the unique key of the required resource.NullPointerException
- if key
is null
.protected void onSearchError(Throwable thrown, String key)
thrown
- describes the error that occurred.key
- the unique key of the required resource.NullPointerException
- if an argument is null
.protected void onFormatError(Throwable thrown, String format, Object... args)
thrown
- describes the error that occurred.format
- a format string used to format the message.args
- the arguments referenced by supplied format
.NullPointerException
- if an argument is null
.public final String tr(String message, Object... args)
message
- the message that will be translated and formatted.args
- the arguments referenced by the translated message.NullPointerException
- if message
is null
.Copyright © OBCOM INGENIERIA S.A. (Chile). All Rights Reserved.