|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.util.Localizer
public class Localizer
The Localizer provides convenient access to localized
strings. It includes built-in support for parameter substitution through
the use of the MessageFormat
utility.
Strings are stored in per-package Properties
files.
The property file for the default locale must be named
localizer.properties
. Additional locales can be supported
through additional property files using the naming conventions specified
in the ResourceBundle
class. For example, the German locale
could be supported through a localizer_de_DE.properties
file.
Nested Class Summary | |
---|---|
static class |
Localizer.Message
A Message can provide a localized message via the
Localizer.Message.getMessage() method call, and can also provide the original key,
package, and substitution array that were used to assemble the message. |
Method Summary | |
---|---|
static void |
addProvider(org.apache.openjpa.lib.util.ResourceBundleProvider provider)
Register a resource provider. |
static Localizer |
forPackage(Class cls)
Return a Localizer instance that will access the properties file in the package of the given class using the system default locale. |
static Localizer |
forPackage(Class cls,
Locale locale)
Return a Localizer instance that will access the properties file in the package of the given class using the given locale. |
Localizer.Message |
get(String key)
Return the localized string matching the given key. |
Localizer.Message |
get(String key,
Object sub)
Return the localized string matching the given key. |
Localizer.Message |
get(String key,
Object[] subs)
Return the localized string matching the given key. |
Localizer.Message |
get(String key,
Object sub1,
Object sub2)
Return the localized string for the given key. |
Localizer.Message |
get(String key,
Object sub1,
Object sub2,
Object sub3)
Return the localized string for the given key. |
Localizer.Message |
getFatal(String key)
Return the localized string matching the given key. |
Localizer.Message |
getFatal(String key,
Object sub)
Return the localized string matching the given key. |
Localizer.Message |
getFatal(String key,
Object[] subs)
Return the localized string matching the given key. |
Localizer.Message |
getFatal(String key,
Object sub1,
Object sub2)
Return the localized string for the given key. |
static boolean |
removeProvider(org.apache.openjpa.lib.util.ResourceBundleProvider provider)
Remove a resource provider. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Localizer forPackage(Class cls)
forPackage(Class,Locale)
public static Localizer forPackage(Class cls, Locale locale)
cls
- the class whose package to check for the localized
properties file; if null, the system will check for
a top-level properties filelocale
- the locale to which strings should be localized; if
null, the system default will be assumedpublic static void addProvider(org.apache.openjpa.lib.util.ResourceBundleProvider provider)
public static boolean removeProvider(org.apache.openjpa.lib.util.ResourceBundleProvider provider)
public Localizer.Message get(String key)
public Localizer.Message getFatal(String key)
public Localizer.Message get(String key, Object sub)
sub
object will be packed into an array and substituted
into the found string according to the rules of the
MessageFormat
class.
get(String)
public Localizer.Message getFatal(String key, Object sub)
sub
object will be packed into an array and substituted
into the found string according to the rules of the
MessageFormat
class.
getFatal(String)
public Localizer.Message get(String key, Object sub1, Object sub2)
get(String,Object)
public Localizer.Message getFatal(String key, Object sub1, Object sub2)
getFatal(String,Object)
public Localizer.Message get(String key, Object sub1, Object sub2, Object sub3)
get(String,Object)
public Localizer.Message get(String key, Object[] subs)
subs
objects will be substituted
into the found string according to the rules of the
MessageFormat
class.
get(String)
public Localizer.Message getFatal(String key, Object[] subs)
subs
objects will be substituted
into the found string according to the rules of the
MessageFormat
class.
getFatal(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |