public class Localizer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_LANGUAGE
the key used to retrieve the locale from the preferences file
|
Constructor and Description |
---|
Localizer()
Create a new Localizer instance init'd from the default locale
|
Localizer(java.util.Properties preferences)
Create a new Localizer instance init'd from the given Properties object
|
Modifier and Type | Method and Description |
---|---|
static Localizer |
currentLocalizer() |
java.lang.String |
get(java.lang.String key) |
ActionLocalizer |
getActionLocalizer() |
java.lang.String |
getCurrentDisplayLanguage()
Return the current Locale for this Localizer
|
java.util.Locale |
getCurrentLocale()
Return the current Locale for this Localizer
|
java.lang.String |
getDefaultLanguage() |
java.lang.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.
|
java.util.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(java.util.Properties preferences)
(Re)init from a Properties object.
|
boolean |
isLocaleSupported(java.util.Locale l) |
static void |
setCurrentLocalizer(Localizer aLocalizer)
set the Localizer that should be used for the jpicedt's class library
|
public static final java.lang.String KEY_LANGUAGE
public Localizer()
public Localizer(java.util.Properties preferences)
public static Localizer currentLocalizer()
public static void setCurrentLocalizer(Localizer aLocalizer)
public boolean isLocaleSupported(java.util.Locale l)
public java.util.Locale[] getSupportedLocales()
public java.lang.String[] getSupportedDisplayLanguages()
public java.util.Locale getCurrentLocale()
public java.lang.String getCurrentDisplayLanguage()
public java.lang.String getDefaultLanguage()
public void init()
public void init(java.util.Properties preferences)
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).
public java.lang.String get(java.lang.String key)
public ActionLocalizer getActionLocalizer()
Submit a bug : syd@jpicedt.org