Package org.nuiton.i18n.init
Class I18nInitializer
java.lang.Object
org.nuiton.i18n.init.I18nInitializer
- Direct Known Subclasses:
ClassPathI18nInitializer,DefaultI18nInitializer
Abstract object to resolv
I18nBundle and prepare initialization of
I18n.- Since:
- 1.1
- Author:
- Tony Chemit - chemit@codelutin.com, Florian Desbois
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CharsetEncoding used to load i18n bundles.protected I18nMessageFormatterMessage formatter used inI18nto produce final translated messages.protected booleanUsed to know if the I18nLanguage has to return null when a key is not found. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet theCharsetencoding used for i18nPropertiesfile loading.Get theI18nMessageFormatterto use on each i18n message translation.booleanGet themissingKeyReturnNullto use on missing keyabstract I18nBundle[]Resolv the bundles.resolvBundles(URL... urls) voidsetEncoding(Charset encoding) Setencodingto use for i18nPropertiesfile loading.voidsetMessageFormatter(I18nMessageFormatter messageFormatter) SetmessageFormatterto use on each i18n message translation.voidsetMissingKeyReturnNull(boolean missingKeyReturnNull) Get themissingKeyReturnNullto use on missing key
-
Field Details
-
encoding
Encoding used to load i18n bundles.- Since:
- 2.4
-
messageFormatter
Message formatter used inI18nto produce final translated messages.- Since:
- 2.4
-
missingKeyReturnNull
protected boolean missingKeyReturnNullUsed to know if the I18nLanguage has to return null when a key is not found.- Since:
- 2.4.1
-
-
Constructor Details
-
I18nInitializer
protected I18nInitializer()
-
-
Method Details
-
resolvBundles
Resolv the bundles.- Returns:
- the bundles detected
- Throws:
Exception- if any pb while getting bundles
-
resolvBundles
- Throws:
Exception
-
getEncoding
Get theCharsetencoding used for i18nPropertiesfile loading.- Returns:
- encoding to use
- Since:
- 2.4
-
setEncoding
Setencodingto use for i18nPropertiesfile loading.- Parameters:
encoding- Charset encoding to use- Throws:
NullPointerException- ifencodingis null- Since:
- 2.4
-
getMessageFormatter
Get theI18nMessageFormatterto use on each i18n message translation.- Returns:
- formatter to use
- Since:
- 2.4
-
setMessageFormatter
SetmessageFormatterto use on each i18n message translation.- Parameters:
messageFormatter- I18nMessageFormatter to use- Throws:
NullPointerException- ifmessageFormatteris null- Since:
- 2.4
-
isMissingKeyReturnNull
public boolean isMissingKeyReturnNull()Get themissingKeyReturnNullto use on missing key- Returns:
- the missingKeyReturnNull parameter
- Since:
- 2.4.1
-
setMissingKeyReturnNull
public void setMissingKeyReturnNull(boolean missingKeyReturnNull) Get themissingKeyReturnNullto use on missing key- Parameters:
missingKeyReturnNull- missingKeyReturnNull to use- Since:
- 2.4.1
-