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 Object
Abstract object to resolvI18nBundle
and prepare initialization ofI18n
.- Since:
- 1.1
- Author:
- Tony Chemit - chemit@codelutin.com, Florian Desbois
-
-
Field Summary
Fields Modifier and Type Field Description protected Charset
encoding
Encoding used to load i18n bundles.protected I18nMessageFormatter
messageFormatter
Message formatter used inI18n
to produce final translated messages.protected boolean
missingKeyReturnNull
Used to know if the I18nLanguage has to return null when a key is not found.
-
Constructor Summary
Constructors Modifier Constructor Description protected
I18nInitializer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Charset
getEncoding()
Get theCharset
encoding used for i18nProperties
file loading.I18nMessageFormatter
getMessageFormatter()
Get theI18nMessageFormatter
to use on each i18n message translation.boolean
isMissingKeyReturnNull()
Get themissingKeyReturnNull
to use on missing keyabstract I18nBundle[]
resolvBundles()
Resolv the bundles.I18nBundle[]
resolvBundles(URL... urls)
void
setEncoding(Charset encoding)
Setencoding
to use for i18nProperties
file loading.void
setMessageFormatter(I18nMessageFormatter messageFormatter)
SetmessageFormatter
to use on each i18n message translation.void
setMissingKeyReturnNull(boolean missingKeyReturnNull)
Get themissingKeyReturnNull
to use on missing key
-
-
-
Field Detail
-
encoding
protected Charset encoding
Encoding used to load i18n bundles.- Since:
- 2.4
-
messageFormatter
protected I18nMessageFormatter messageFormatter
Message formatter used inI18n
to produce final translated messages.- Since:
- 2.4
-
missingKeyReturnNull
protected boolean missingKeyReturnNull
Used to know if the I18nLanguage has to return null when a key is not found.- Since:
- 2.4.1
-
-
Method Detail
-
resolvBundles
public abstract I18nBundle[] resolvBundles() throws Exception
Resolv the bundles.- Returns:
- the bundles detected
- Throws:
Exception
- if any pb while getting bundles
-
resolvBundles
public I18nBundle[] resolvBundles(URL... urls) throws Exception
- Throws:
Exception
-
getEncoding
public Charset getEncoding()
Get theCharset
encoding used for i18nProperties
file loading.- Returns:
- encoding to use
- Since:
- 2.4
-
setEncoding
public void setEncoding(Charset encoding) throws NullPointerException
Setencoding
to use for i18nProperties
file loading.- Parameters:
encoding
- Charset encoding to use- Throws:
NullPointerException
- ifencoding
is null- Since:
- 2.4
-
getMessageFormatter
public I18nMessageFormatter getMessageFormatter()
Get theI18nMessageFormatter
to use on each i18n message translation.- Returns:
- formatter to use
- Since:
- 2.4
-
setMessageFormatter
public void setMessageFormatter(I18nMessageFormatter messageFormatter) throws NullPointerException
SetmessageFormatter
to use on each i18n message translation.- Parameters:
messageFormatter
- I18nMessageFormatter to use- Throws:
NullPointerException
- ifmessageFormatter
is null- Since:
- 2.4
-
isMissingKeyReturnNull
public boolean isMissingKeyReturnNull()
Get themissingKeyReturnNull
to use on missing key- Returns:
- the missingKeyReturnNull parameter
- Since:
- 2.4.1
-
setMissingKeyReturnNull
public void setMissingKeyReturnNull(boolean missingKeyReturnNull)
Get themissingKeyReturnNull
to use on missing key- Parameters:
missingKeyReturnNull
- missingKeyReturnNull to use- Since:
- 2.4.1
-
-