Package org.nuiton.i18n.init
Class DefaultI18nInitializer
- java.lang.Object
-
- org.nuiton.i18n.init.I18nInitializer
-
- org.nuiton.i18n.init.DefaultI18nInitializer
-
- Direct Known Subclasses:
UserI18nInitializer
public class DefaultI18nInitializer extends I18nInitializer
Default implementation of aI18nInitializer
using the default i18n implementation (one unique bundle with a definition properties file).- Since:
- 1.1
- Author:
- Tony Chemit - chemit@codelutin.com
-
-
Field Summary
Fields Modifier and Type Field Description static String
BUNDLE_DEF_ENCODING
static String
BUNDLE_DEF_LOCALES
static String
BUNDLE_DEF_VERSION
protected String
bundleName
the name of the bundle.static String
BUNDLES_FOR_LOCALE
static String
DEFAULT_I18N_PATH
protected URL
definitionURL
location of the definition file.protected String
i18nPath
i18n path where to seek for resources (optional).protected ClassLoader
loader
class loader to use (optional).static String
UNIQUE_BUNDLE_DEF
static String
UNIQUE_BUNDLE_ENTRY
-
Fields inherited from class org.nuiton.i18n.init.I18nInitializer
encoding, messageFormatter, missingKeyReturnNull
-
-
Constructor Summary
Constructors Constructor Description DefaultI18nInitializer(String bundleName)
DefaultI18nInitializer(String bundleName, ClassLoader loader)
DefaultI18nInitializer(String bundleName, ClassLoader loader, String i18nPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getBundleName()
URL
getDefinitionURL()
String
getI18nPath()
ClassLoader
getLoader()
protected URL
getResourceURL(String resource)
I18nBundle[]
resolvBundles()
Resolv the bundles.String
resolvDefinition(Properties properties)
URL[]
resolvURLs(String prefixURL, Properties definition)
protected void
setI18nPath(String i18nPath)
protected void
setLoader(ClassLoader loader)
-
Methods inherited from class org.nuiton.i18n.init.I18nInitializer
getEncoding, getMessageFormatter, isMissingKeyReturnNull, resolvBundles, setEncoding, setMessageFormatter, setMissingKeyReturnNull
-
-
-
-
Field Detail
-
UNIQUE_BUNDLE_DEF
public static String UNIQUE_BUNDLE_DEF
-
UNIQUE_BUNDLE_ENTRY
public static String UNIQUE_BUNDLE_ENTRY
-
BUNDLE_DEF_LOCALES
public static String BUNDLE_DEF_LOCALES
-
BUNDLE_DEF_VERSION
public static String BUNDLE_DEF_VERSION
-
BUNDLE_DEF_ENCODING
public static String BUNDLE_DEF_ENCODING
-
BUNDLES_FOR_LOCALE
public static String BUNDLES_FOR_LOCALE
-
bundleName
protected final String bundleName
the name of the bundle.
-
loader
protected ClassLoader loader
class loader to use (optional).
-
i18nPath
protected String i18nPath
i18n path where to seek for resources (optional).
-
definitionURL
protected URL definitionURL
location of the definition file.
-
DEFAULT_I18N_PATH
public static final String DEFAULT_I18N_PATH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultI18nInitializer
public DefaultI18nInitializer(String bundleName) throws NullPointerException
- Throws:
NullPointerException
-
DefaultI18nInitializer
public DefaultI18nInitializer(String bundleName, ClassLoader loader) throws NullPointerException
- Throws:
NullPointerException
-
DefaultI18nInitializer
public DefaultI18nInitializer(String bundleName, ClassLoader loader, String i18nPath) throws NullPointerException
- Throws:
NullPointerException
-
-
Method Detail
-
getBundleName
public String getBundleName()
-
getLoader
public ClassLoader getLoader()
-
getI18nPath
public String getI18nPath()
-
setLoader
protected void setLoader(ClassLoader loader)
-
setI18nPath
protected void setI18nPath(String i18nPath)
-
resolvDefinition
public String resolvDefinition(Properties properties) throws Exception
- Throws:
Exception
-
getDefinitionURL
public URL getDefinitionURL() throws NullPointerException
- Throws:
NullPointerException
-
resolvURLs
public URL[] resolvURLs(String prefixURL, Properties definition) throws Exception
- Throws:
Exception
-
resolvBundles
public I18nBundle[] resolvBundles() throws Exception
Description copied from class:I18nInitializer
Resolv the bundles.- Specified by:
resolvBundles
in classI18nInitializer
- Returns:
- the bundles detected
- Throws:
Exception
- if any pb while getting bundles
-
-