public class Localiser extends Object
getInstancemethod. Any plugin that provides its own resources via a properties file should call
Localiser.registerBundle(...)before the resources are required to be used.
The DataNucleus system is internationalisable hence messages (to log files or exceptions) can be displayed in multiple languages. Currently DataNucleus contains localisation files in the English and Spanish, but can be extended easily by adding localisation files in languages such as French, etc. The internationalisation operates around a Java ResourceBundle, loading a properties file. Messages are output via calling
Localiser.msg("012345", args);The messages themselves are contained in a file for each package. For example, with the above example, we have "org.datanucleus.Localisation.properties". This contains entries such as
012345=Initialising Schema "{0}" using "{1}" auto-start optionSo the 2 parameters specified in the
Localiser.msg(...)call are inserted into the message.
Constructor and Description |
---|
Localiser() |
Modifier and Type | Method and Description |
---|---|
static String |
msg(String messageKey)
Message formatter for an internationalised message.
|
static String |
msg(String messageKey,
long arg)
Message formatter with one argument passed in that will be embedded in an internationalised message.
|
static String |
msg(String messageKey,
Object... args)
Message formatter with arguments passed in that will be embedded in an internationalised message.
|
static void |
registerBundle(String bundleName,
ClassLoader loader)
Method to be called by plugins that have their own ResourceBundle, so the messages will be registered
and available for use.
|
public static void registerBundle(String bundleName, ClassLoader loader)
bundleName
- Name of the bundle e.g "org.datanucleus.store.myplugin.Localisation"loader
- Loader for the bundlepublic static String msg(String messageKey)
messageKey
- the message keypublic static String msg(String messageKey, long arg)
messageKey
- the message keyarg
- the long argumentCopyright © 2019. All rights reserved.