|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tigris.gef.util.Localizer
This class manages the resource bundle files needed to localize the application. All registered resource files are searched in order to find the localization of a given string.
Field Summary | |
protected static java.lang.String |
SHORTCUT_MODIFIER
AWT has no standard way to name the platforms default menu shortcut modifier for a KeyStroke, so the localizer replaces each occurence of "shortcut" with Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() |
Constructor Summary | |
Localizer()
|
Method Summary | |
static void |
addLocale(java.util.Locale locale)
The method addLocale adds a new locale to the set of known locales for the application. |
static void |
addResource(java.lang.String binding,
java.lang.String resourceName)
The method adds a new resource under the given name. |
static void |
addResource(java.lang.String binding,
java.lang.String resourceName,
java.lang.ClassLoader loader)
|
static void |
addResource(java.lang.String binding,
java.lang.String resourceName,
java.util.Locale locale)
|
static void |
addResource(java.lang.String binding,
java.lang.String resourceName,
java.util.Locale locale,
java.lang.ClassLoader loader)
|
static boolean |
containsKey(java.lang.String binding,
java.lang.String key)
Check if a resource contains a specific key (for the current default locale) |
static boolean |
containsKey(java.lang.String binding,
java.lang.String key,
java.util.Locale locale,
java.util.Map resources)
|
static boolean |
containsLocale(java.util.Locale locale)
This method tests, if the given locale is registered. |
static boolean |
containsResource(java.lang.String resource)
This method tests, if a resource with the given name is registered. |
static java.util.Locale |
getCurrentLocale()
The method returns the current locale. |
static java.util.Set |
getKeys(java.lang.String binding)
Returns a Set that contains all keys (strings) defined in the given resource (for the current default locale) |
static java.util.Map |
getResourcesFor(java.util.Locale locale)
The method returns all resources for the given locale. |
static javax.swing.KeyStroke |
getShortcut(java.lang.String binding,
java.lang.String key)
This function returns a localized menu shortcut key to the specified key. |
static javax.swing.KeyStroke |
getShortcut(java.lang.String binding,
java.lang.String key,
java.util.Locale locale,
java.util.Map resources)
|
static java.lang.String |
localize(java.lang.String binding,
java.lang.String key)
This function returns a localized string corresponding to the specified key. |
static java.lang.String |
localize(java.lang.String binding,
java.lang.String key,
java.util.Locale locale,
java.util.Map resources)
|
static void |
removeLocale(java.util.Locale locale)
The method removes the given locale from the list of known locales. |
static void |
removeResource(java.lang.String binding)
The method removes the given resource from the list of used resources. |
static void |
switchCurrentLocale(java.util.Locale locale)
The method changes the current locale to the given one. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String SHORTCUT_MODIFIER
Constructor Detail |
public Localizer()
Method Detail |
public static boolean containsResource(java.lang.String resource)
resource
- Name of the resource to be tested.
public static boolean containsLocale(java.util.Locale locale)
locale
- Locale to be tested.
public static void addLocale(java.util.Locale locale)
ResourceBundle
,
Locale
public static void switchCurrentLocale(java.util.Locale locale)
Locale
public static java.util.Locale getCurrentLocale()
public static java.util.Map getResourcesFor(java.util.Locale locale)
locale
- Resources are searched for this locale.
public static void addResource(java.lang.String binding, java.lang.String resourceName) throws java.util.MissingResourceException
resourceName
- Name of the resource to be registered.binding
- Name under which the resource should be registered.
java.util.MissingResourceException
public static void addResource(java.lang.String binding, java.lang.String resourceName, java.lang.ClassLoader loader) throws java.util.MissingResourceException
java.util.MissingResourceException
public static void addResource(java.lang.String binding, java.lang.String resourceName, java.util.Locale locale) throws java.util.MissingResourceException
java.util.MissingResourceException
public static void addResource(java.lang.String binding, java.lang.String resourceName, java.util.Locale locale, java.lang.ClassLoader loader) throws java.util.MissingResourceException
java.util.MissingResourceException
public static void removeLocale(java.util.Locale locale)
locale
- Locale to be removed.public static void removeResource(java.lang.String binding)
binding
- Name under which the resource to be removed is registered.public static java.lang.String localize(java.lang.String binding, java.lang.String key)
binding
- ResourceBundles to search in.key
- String to be localized.
public static java.lang.String localize(java.lang.String binding, java.lang.String key, java.util.Locale locale, java.util.Map resources)
public static boolean containsKey(java.lang.String binding, java.lang.String key)
binding
- key
-
public static boolean containsKey(java.lang.String binding, java.lang.String key, java.util.Locale locale, java.util.Map resources)
public static java.util.Set getKeys(java.lang.String binding)
binding
- the resource name whose keys should be returned
public static javax.swing.KeyStroke getShortcut(java.lang.String binding, java.lang.String key)
binding
- Name of resource to be searched.key
- Shortcut string to be localized.
public static javax.swing.KeyStroke getShortcut(java.lang.String binding, java.lang.String key, java.util.Locale locale, java.util.Map resources)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |