Package nz.org.riskscape.engine.i18n
Class ResourceBundleControl
java.lang.Object
java.util.ResourceBundle.Control
nz.org.riskscape.engine.i18n.ResourceBundleControl
Extends Java's default ResourceBundle.Control
to:
* Assumes properties files are encoded in utf-8 instead of latin-1
* Support loading the same named file from different locations to take the super-set of values from all, but with
last-one-wins behavior, where last-one is the last resource identified by the classloader as having that name
* Disables fall-back locale behavior so that this can be handled in the message source
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ResourceBundleControl
static final String
Charset to load properties files in.Fields inherited from class java.util.ResourceBundle.Control
FORMAT_CLASS, FORMAT_DEFAULT, FORMAT_PROPERTIES, TTL_DONT_CACHE, TTL_NO_EXPIRATION_CONTROL
-
Method Summary
Modifier and TypeMethodDescriptiongetFallbackLocale
(String baseName, Locale locale) getFormats
(String baseName) newBundle
(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) Methods inherited from class java.util.ResourceBundle.Control
getCandidateLocales, getControl, getNoFallbackControl, getTimeToLive, needsReload, toBundleName, toResourceName
-
Field Details
-
INSTANCE
-
PROPS_FILE_CHARSET
Charset to load properties files in. Avoids translators having to put escape codes in properties files. Java9 does this by default as well.
- See Also:
-
-
Method Details
-
getFormats
- Overrides:
getFormats
in classResourceBundle.Control
-
getFallbackLocale
- Overrides:
getFallbackLocale
in classResourceBundle.Control
-
newBundle
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException - Overrides:
newBundle
in classResourceBundle.Control
- Throws:
IllegalAccessException
InstantiationException
IOException
-