Package cl.obcom.desktopfx.util
Class I18nBase
java.lang.Object
cl.obcom.desktopfx.util.I18nBase
Provides internationalization (i18n) services.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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.final String
Translates and formats a message using supplied optional arguments.
-
Constructor Details
-
I18nBase
Constructs a newI18nBase
instance. The resource bundles must be located in the package of classresClass
. The resource bundles are loaded using de default locale, and the class loader of classresClass
. The names of the resource bundles must start with the specifiedresPrefix
.- Parameters:
resClass
- the class reference used to load resources.resPrefix
- the prefix of all resource bundle names.- Throws:
NullPointerException
- if an argument isnull
.- See Also:
-
-
Method Details
-
onResourceNotFound
Called when a resource indexed by supplied key was not found.- Parameters:
key
- the unique key of the required resource.- Throws:
NullPointerException
- ifkey
isnull
.
-
onSearchError
Called when an error occurs searching for a resource with key.- Parameters:
thrown
- describes the error that occurred.key
- the unique key of the required resource.- Throws:
NullPointerException
- if an argument isnull
.
-
onFormatError
Called when an error occurs formating an i18n message.- Parameters:
thrown
- describes the error that occurred.format
- a format string used to format the message.args
- the arguments referenced by suppliedformat
.- Throws:
NullPointerException
- if an argument isnull
.
-
tr
Translates and formats a message using supplied optional arguments.- Parameters:
message
- the message that will be translated and formatted.args
- the arguments referenced by the translated message.- Returns:
- the translated and formatted i18n message.
- Throws:
NullPointerException
- ifmessage
isnull
.
-