Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| SWIXML 1.6 (#161)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.swixml
Class Localizer

    java.lang.Object
      org.swixml.Localizer

    public class Localizer

extends Object

The `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.
For example, if the resource bundle contains strings for the following single keys:
a = Alpha
b = Bravo
c = Charlie
then calling getString("a,b,c") will result in a String containing the comma sepearted values, like "Alpha,Brave,Charlie"
Look at the provided testcase for more details.

Version:
  $Revision: 1.2 $
Author:
  Wolf Paulus
See Also:
  `XTabbedPane.setTitles(String)`

Constructor Summary
`Localizer()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Localizer

    public Localizer()

Method Detail

### setSeparator

    public static void setSeparator(String regExp)

  Sets the regular expression used to split a key, that could not be found in the resource bundle.

  Parameters:
    `regExp` - `String`
  See Also:
    `String.split(java.lang.String, int)`, `getString(java.lang.String)`

### getString

    public String getString(String key)

  Returns the localized String baseed on the given key. If the key cannot be found, the key is returned insstead.

  Parameters:
    `key` - `String`
  Returns:
    `String` - localized String , or key , if no lacalization is found.

### setLocale

    public void setLocale(Locale locale)

  Sets this Localizer's locale.

  Parameters:
    `locale` - `Locale`

### setResourceBundle

    public void setResourceBundle(String bundleName)
                           throws MissingResourceException

  Sets this Localizer's ResourceBundle.

  Parameters:
    `bundleName` - `String`ResourceBundle file / class name
  Throws:
    `MissingResourceException` - - if no resource bundle for the specified base name can be found

### isUsable

    public boolean isUsable()

  Informs about the usablility of this Localizer.

  Returns:
    `boolean` - true if Localizer is setup with Locale and ResourceBundle.

### getClassLoader

    public ClassLoader getClassLoader()

  Returns:
    `ClassLoader` returns the classloader attribute, which has probably been set by the SwingEngine

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| SWIXML 1.6 (#161)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 - 2011 - Wolf Paulus - wolfpaulus.com. All rights reserved.