|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.shineframework.common.i18n.Localizer
public class Localizer
This class is responsible for the l10n. Any localized string in the system
should be translated using this class.
The localizer class searches the classpath for a resource messagesBundle with
the base name shinefw_messages. All the messages in the system are expected
to be found in the single resource messagesBundle properties file.
| Field Summary | |
|---|---|
static java.lang.String |
FORMATS_BUNDLE_NAME
|
static java.lang.String |
MESSAGES_BUNDLE_NAME
|
| Constructor Summary | |
|---|---|
Localizer()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
format(java.lang.String patternName,
java.lang.Object... params)
|
static java.lang.StringBuffer |
format(java.lang.String patternName,
java.lang.StringBuffer result,
java.util.Locale l,
java.lang.Object... params)
|
static java.util.Locale |
getDefaultLocale()
|
static java.lang.String |
getMessage(java.lang.String key)
Loads a message from a resource messagesBundle |
static java.lang.String |
getMessage(java.lang.String key,
java.util.Locale l)
Loads a message from a resource messagesBundle |
static java.lang.String |
getMessage(java.lang.String key,
java.util.Locale l,
java.lang.Object... params)
Loads a message pattern from the resource messagesBundle and format it using the MessageFormat class |
static java.lang.String |
getMessage(java.lang.String key,
java.lang.Object... params)
|
static boolean |
isKeyExist(java.lang.String key)
Checks if message exists |
static boolean |
isKeyExist(java.lang.String key,
java.util.Locale l)
Checks if message exists |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String MESSAGES_BUNDLE_NAME
public static final java.lang.String FORMATS_BUNDLE_NAME
| Constructor Detail |
|---|
public Localizer()
| Method Detail |
|---|
public static java.util.Locale getDefaultLocale()
public static boolean isKeyExist(java.lang.String key)
key - the key of the message
public static boolean isKeyExist(java.lang.String key,
java.util.Locale l)
key - the key of the message
public static java.lang.String getMessage(java.lang.String key)
key - the key of the message
public static java.lang.String getMessage(java.lang.String key,
java.util.Locale l)
key - the key of the messagel - locale
public static java.lang.String getMessage(java.lang.String key,
java.util.Locale l,
java.lang.Object... params)
MessageFormat class
key - the key of the messageparams - the arguments to the messagel - locale
public static java.lang.String getMessage(java.lang.String key,
java.lang.Object... params)
public static java.lang.String format(java.lang.String patternName,
java.lang.Object... params)
public static java.lang.StringBuffer format(java.lang.String patternName,
java.lang.StringBuffer result,
java.util.Locale l,
java.lang.Object... params)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||