Package org.nuiton.i18n.init
Class I18nInitializer
java.lang.Object
org.nuiton.i18n.init.I18nInitializer
- Direct Known Subclasses:
ClassPathI18nInitializer,DefaultI18nInitializer
public abstract class I18nInitializer
extends java.lang.Object
Abstract object to resolv
I18nBundle and prepare initialization of
I18n.- Since:
- 1.1
- Author:
- Tony Chemit - chemit@codelutin.com, Florian Desbois
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.charset.CharsetencodingEncoding used to load i18n bundles.protected I18nMessageFormattermessageFormatterMessage formatter used inI18nto produce final translated messages.protected booleanmissingKeyReturnNullUsed to know if the I18nLanguage has to return null when a key is not found. -
Constructor Summary
Constructors Modifier Constructor Description protectedI18nInitializer() -
Method Summary
Modifier and Type Method Description java.nio.charset.CharsetgetEncoding()Get theCharsetencoding used for i18nPropertiesfile loading.I18nMessageFormattergetMessageFormatter()Get theI18nMessageFormatterto use on each i18n message translation.booleanisMissingKeyReturnNull()Get themissingKeyReturnNullto use on missing keyabstract I18nBundle[]resolvBundles()Resolv the bundles.I18nBundle[]resolvBundles(java.net.URL... urls)voidsetEncoding(java.nio.charset.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
protected java.nio.charset.Charset encodingEncoding 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:
java.lang.Exception- if any pb while getting bundles
-
resolvBundles
- Throws:
java.lang.Exception
-
getEncoding
public java.nio.charset.Charset getEncoding()Get theCharsetencoding used for i18nPropertiesfile loading.- Returns:
- encoding to use
- Since:
- 2.4
-
setEncoding
public void setEncoding(java.nio.charset.Charset encoding) throws java.lang.NullPointerExceptionSetencodingto use for i18nPropertiesfile loading.- Parameters:
encoding- Charset encoding to use- Throws:
java.lang.NullPointerException- ifencodingis null- Since:
- 2.4
-
getMessageFormatter
Get theI18nMessageFormatterto use on each i18n message translation.- Returns:
- formatter to use
- Since:
- 2.4
-
setMessageFormatter
public void setMessageFormatter(I18nMessageFormatter messageFormatter) throws java.lang.NullPointerExceptionSetmessageFormatterto use on each i18n message translation.- Parameters:
messageFormatter- I18nMessageFormatter to use- Throws:
java.lang.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
-