Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpicedt
Class Localizer

    java.lang.Object
      jpicedt.Localizer

public class Localizer
extends Object

Localizer for all classes of the jpicedt's tree.
It uses "lang/i18n_xx_yy.properties" resource file, where xx_yy is the Locale. If not found, uses "lang/i18n.properties" (same as i18n_en.properties) As of 2005/12, support for localized help-files added by Jobst Hoffmann.

Since:
  jpicedt 1.3.2
Version:
  $Id: Localizer.java,v 1.10.2.1 2007/09/02 11:55:59 reynal Exp $
Author:
  Sylvain Reynal

Field Summary
`static String` | `KEY_LANGUAGE` the key used to retrieve the locale from the preferences file

Constructor Summary
`Localizer()` Create a new Localizer instance init'd from the default locale
`Localizer(Properties preferences)` Create a new Localizer instance init'd from the given Properties object

Method Summary
`static Localizer` | `currentLocalizer()`
`String` | `get(String key)`
`ActionLocalizer` | `getActionLocalizer()`
`String` | `getCurrentDisplayLanguage()` Return the current Locale for this Localizer
`Locale` | `getCurrentLocale()` Return the current Locale for this Localizer
`String` | `getDefaultLanguage()`
`String[]` | `getSupportedDisplayLanguages()` Return an array containing all languages this localizer supports, returned in the same format as Locale.getDisplayLanguage(inLocale), yet localized using the current Locale e.g.
`Locale[]` | `getSupportedLocales()` Return an array containing all Locales this localizer supports, by looking up the "lang/" subdirectory.
`void` | `init()` Init ResourceBundle using OS's default Locale
`void` | `init(Properties preferences)` (Re)init from a Properties object.
`boolean` | `isLocaleSupported(Locale l)`
`static void` | `setCurrentLocalizer(Localizer aLocalizer)` set the Localizer that should be used for the jpicedt's class library

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

Field Detail

### KEY_LANGUAGE

    public static final String KEY_LANGUAGE

  the key used to retrieve the locale from the preferences file

  See Also:
    Constant Field Values

Constructor Detail

### Localizer

    public Localizer()

  Create a new Localizer instance init'd from the default locale

### Localizer

    public Localizer(Properties preferences)

  Create a new Localizer instance init'd from the given Properties object

Method Detail

### currentLocalizer

    public static Localizer currentLocalizer()

  Returns:
    the current Localizer

### setCurrentLocalizer

    public static void setCurrentLocalizer(Localizer aLocalizer)

  set the Localizer that should be used for the jpicedt's class library

### isLocaleSupported

    public boolean isLocaleSupported(Locale l)

  Returns:
    whether the given Locale is supported by this Localizer or not. Only the language is checked, not the country, nor the variant.

### getSupportedLocales

    public Locale[] getSupportedLocales()

  Return an array containing all Locales this localizer supports, by looking up the "lang/" subdirectory.

### getSupportedDisplayLanguages

    public String[] getSupportedDisplayLanguages()

  Return an array containing all languages this localizer supports, returned in the same format as Locale.getDisplayLanguage(inLocale), yet localized using the current Locale e.g. "anglais,espagnol,francais,portugais" is current locale is "fr".

### getCurrentLocale

    public Locale getCurrentLocale()

  Return the current Locale for this Localizer

### getCurrentDisplayLanguage

    public String getCurrentDisplayLanguage()

  Return the current Locale for this Localizer

### getDefaultLanguage

    public String getDefaultLanguage()

  Returns:
    the default language (localized using the current locale), in the same format as returned by Locale.getDisplayLanguage() and getSupportedLanguages(), e.g. "anglais" if current locale is "fr", and default locale is "en".

### init

    public void init()

  Init ResourceBundle using OS's default Locale

### init

    public void init(Properties preferences)

  (Re)init from a Properties object.

  First a Locale is fetched from the given Properties object, using key=PREFERENCE_KEY (values having to be valid ISO639 codes acceptable by the Locale constructor) then a ResourceBundle is loaded using this Locale. Finally, the current Locale is written back to the given Properties to reflect change (if any, e.g. if the Locale was not found in the Properties object).

### get

    public String get(String key)

  Returns:
    a localized version of the given key ; the key if no ResourceBundle was found.
  Since:
    PicEdt 1.2

### getActionLocalizer

    public ActionLocalizer getActionLocalizer()

  Returns:
    an action localizer that's suited for the current locale This implementation returns a PEActionLocalizer built from the same ResourceBundle as the one used for message internationalization.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org