Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## serp.util
Class Localizer

    java.lang.Object
      |
      +--serp.util.Localizer

public class Localizer
extends Object

The Localizer provides convenient access to localized strings. It inlcudes built-in support for parameter substitution through the use of the `MessageFormat` utility.

Strings are stored in per-package `Properties` files. The property file for the default locale must be named `localizer.properties`. Additional locales can be supported through additional property files using the naming conventions specified in the `ResourceBundle` class. For example, the german locale could be supported through a `localizer_de_DE.properties` file.

Constructor Summary
`Localizer()`

Method Summary
`(package private) static void` | `()`
`static Localizer` | `forPackage(Class cls)` Return a Localizer instance that will access the properties file in the package of the given class using the system default locale.
`static Localizer` | `forPackage(Class cls, Locale locale)` Return a Localizer instance that will access the properties file in the package of the given class using the given locale.
`String` | `get(String key)` Return the localized string matching the given key.
`String` | `get(String key, Locale locale)` Return the localized string matching the given key.
`String` | `get(String key, Object sub)` Return the localized string matching the given key.
`String` | `get(String key, Object[] subs)` Return the localized string matching the given key.
`String` | `get(String key, Object[] subs, Locale locale)` Return the localized string matching the given key according to the given locale.
`String` | `get(String key, Object sub, Locale locale)` Return the localized string matching the given key according to the given locale.
`String` | `get(String key, Object sub1, Object sub2)` Return the localized string for the given key.
`String` | `get(String key, Object sub1, Object sub2, Locale locale)` Return the localized string matching the given key according to the given locale.
`String` | `get(String key, Object sub1, Object sub2, Object sub3)` Return the localized string for the given key.
`String` | `get(String key, Object sub1, Object sub2, Object sub3, Locale locale)` Return the localized string matching the given key according to the given locale.
`static void` | `registerProvider(ResourceBundleProvider provider)` Register a resource provider.
`static boolean` | `removeProvider(ResourceBundleProvider provider)` Remove a resource provider.

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

###

    static void ()

### forPackage

    public static Localizer forPackage(Class cls)

  Return a Localizer instance that will access the properties file in the package of the given class using the system default locale.
  See Also:
    `forPackage(Class,Locale)`

### forPackage

    public static Localizer forPackage(Class cls,
                                       Locale locale)

  Return a Localizer instance that will access the properties file in the package of the given class using the given locale.
  Parameters:
    `cls` - the class whose package to check for the localized properties file; if null, the system will check for a top-level properties file
    `locale` - the locale to which strings should be localized; if null, the system default will be assumed

### registerProvider

    public static void registerProvider(ResourceBundleProvider provider)

  Register a resource provider.

### removeProvider

    public static boolean removeProvider(ResourceBundleProvider provider)

  Remove a resource provider.

### get

    public String get(String key)

  Return the localized string matching the given key.
  See Also:
    `get(String,Locale)`

### get

    public String get(String key,
                      Object sub)

  Return the localized string matching the given key. The given `sub` object will be packed into an array and substituted into the found string according to the rules of the `MessageFormat` class.
  See Also:
    `get(String,Locale)`

### get

    public String get(String key,
                      Object sub1,
                      Object sub2)

  Return the localized string for the given key.
  See Also:
    `get(String,Object)`

### get

    public String get(String key,
                      Object sub1,
                      Object sub2,
                      Object sub3)

  Return the localized string for the given key.
  See Also:
    `get(String,Object)`

### get

    public String get(String key,
                      Object[] subs)

  Return the localized string matching the given key. The given `subs` objects will be substituted into the found string according to the rules of the `MessageFormat` class.
  See Also:
    `get(String,Locale)`

### get

    public String get(String key,
                      Object sub,
                      Locale locale)

  Return the localized string matching the given key according to the given locale. The given `sub` object will be packed into an array and substituted into the found string according to the rules of the `MessageFormat` class.
  See Also:
    `get(String,Locale)`

### get

    public String get(String key,
                      Object sub1,
                      Object sub2,
                      Locale locale)

  Return the localized string matching the given key according to the given locale.
  See Also:
    `get(String,Object,Locale)`

### get

    public String get(String key,
                      Object sub1,
                      Object sub2,
                      Object sub3,
                      Locale locale)

  Return the localized string matching the given key according to the given locale.
  See Also:
    `get(String,Object,Locale)`

### get

    public String get(String key,
                      Object[] subs,
                      Locale locale)

  Return the localized string matching the given key according to the given locale. The given `subs` objects will be substituted into the found string according to the rules of the `MessageFormat` class.
  See Also:
    `get(String,Locale)`

### get

    public String get(String key,
                      Locale locale)

  Return the localized string matching the given key.
  Parameters:
    `key` - the key in the properties file of the string to return
    `locale` - the locale to localize the message for, or null for the default locale
  Throws:
    `MissingResourceException` - if the localized properties file or requested key is not found

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.8 generated on January 11 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.