|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.zuercher.gpx2map.i18n.Text
public class Text
Text provides utility methods for retrieve localized text.
Field Summary | |
---|---|
private ResourceBundle |
bundle
Text instance's configured resource bundle. |
private static Text |
instance
Singleton instance of Text. |
private static Locale |
instanceLocale
Locale used to configure the singleton. |
Constructor Summary | |
---|---|
private |
Text(Locale locale)
Constructs a new Text instance. |
Method Summary | |
---|---|
String |
get(String key,
Object... parameters)
Retrieves the string for the given key from the configured resource bundle and, optionally, performs message formatting on the on the string. |
static Text |
getInstance()
Retrieve the singleton instance of Text. |
private String |
keyToErrorResult(String key,
Object... parameters)
Converts a key and parameters in "key[parameters...]"
format. |
static void |
setInstanceLocale(Locale locale)
Configures the singleton instance's locale. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static Text instance
private static Locale instanceLocale
singleton
is instantiated via
setInstanceLocale(Locale)
.
private final ResourceBundle bundle
Constructor Detail |
---|
private Text(Locale locale)
locale
- the locale to use for resource bundle namingMethod Detail |
---|
public static void setInstanceLocale(Locale locale)
getInstance()
. The instance
locale defaults to the system locale.
locale
- new locale to use for singleton instance
IllegalStateException
- if getInstance()
has already
been calledpublic static Text getInstance()
setInstanceLocale(Locale)
before
calling this method.
public String get(String key, Object... parameters)
If the key is not found in the resource bundle, the key is returned.
If no parameters are given, the string from the resource bundle is returned unchanged.
If parameters are given, but the string from the resource bundle is not not a valid pattern, the key is returned.
key
- the resource property keyparameters
- parameters to apply to the resource value
keyToErrorResult(String, Object[])
private String keyToErrorResult(String key, Object... parameters)
"key[parameters...]"
format.
key
- resource property keyparameters
- parameters to apply to the resource value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |