public class Localizer extends Object
Localizer
class provides consumers with a simple localization tools: getString(key)
.
Locale and ResourceBundle need to be set to use it.
Since some setters accept comma separated lists of Strings, e.g. a TabbedPane's setTitles methods, the Localizer will
try to split a given key by commas if the key doesn't resolve, i.e. a MissingResourceException
is
thrown. XTabbedPane.setTitles(String)
Constructor and Description |
---|
Localizer() |
Modifier and Type | Method and Description |
---|---|
ClassLoader |
getClassLoader() |
String |
getString(String key)
Returns the localized String baseed on the given key.
|
boolean |
isUsable()
Informs about the usablility of this Localizer.
|
void |
setLocale(Locale locale)
Sets this Localizer's locale.
|
void |
setResourceBundle(String bundleName)
Sets this Localizer's ResourceBundle.
|
static void |
setSeparator(String regExp)
Sets the regular expression used to split a key, that could not be found in the resource bundle.
|
public static void setSeparator(String regExp)
regExp
- String
String.split(java.lang.String, int)
,
getString(java.lang.String)
public String getString(String key)
key
- String
String
- localized String , or key , if no lacalization is found.public void setLocale(Locale locale)
locale
- Locale
public void setResourceBundle(String bundleName) throws MissingResourceException
bundleName
- String
ResourceBundle file / class nameMissingResourceException
- - if no resource bundle for the specified base name can be foundpublic boolean isUsable()
boolean
- true if Localizer is setup with Locale and ResourceBundle.public ClassLoader getClassLoader()
ClassLoader
returns the classloader attribute, which has probably been set by the SwingEngineCopyright (c) 2002 - 2015 - Wolf Paulus - wolfpaulus.com. All rights reserved.