Dashboard Builder Commons 6.2.0.CR3

org.jboss.dashboard
Class LocaleManager

java.lang.Object
  extended by org.jboss.dashboard.LocaleManager

@ApplicationScoped
@Named(value="localeManager")
public class LocaleManager
extends Object

Manager that holds the list of languages supported.


Field Summary
protected  String defaultLocaleId
          The default localeId.
protected  String[] installedLocaleIds
          The list of locales supported.
 
Constructor Summary
LocaleManager()
           
 
Method Summary
static String currentLang()
          Static getter for current lang.
static Locale currentLocale()
          Static getter for current Locale.
 String[] getAllLanguages()
          Get all language identifiers
 Locale[] getAllLocales()
          Locales supported by the VM
 ResourceBundle getBundle(String baseName)
          ================================================================== BZ-1031080: RESOURCE BUNDLE CUSTOM HANDLING Use another NoFallbackControl implementation than the default one
 ResourceBundle getBundle(String baseName, Locale targetLocale)
           
 ResourceBundle getBundle(String baseName, Locale targetLocale, ClassLoader loader)
           
 String getCurrentLang()
          Get the current language for displaying contents
 Locale getCurrentLocale()
          Current locale for viewing contents
 String getDefaultLang()
          Get the default language for the platform
 Locale getDefaultLocale()
          Default locale for the application
 String getDefaultLocaleId()
           
 String[] getInstalledLocaleIds()
           
 String getLangDisplayName(String lang)
          Return the display name (in current locale) of the specified lang
protected  String[] getLanguages(Locale[] locales)
           
 Locale getLocaleById(String localeId)
          Get a Locale by its id.
 String[] getPlatformAvailableLangs()
          Langs supported.
 Locale[] getPlatformAvailableLocales()
          Locales supported by the platform
 Locale getPlatformLocale(Locale l)
           
 void init()
           
 Object localize(Map localizedData)
          Given a map of locale->value or language->value, it returns the appropriate value for the current locale.
static LocaleManager lookup()
           
 void setCurrentLang(String langId)
          Set the current language for displaying contents
 void setCurrentLocale(Locale l)
           
 void setDefaultLocale(Locale defaultLocale)
           
 void setDefaultLocaleId(String defaultLocale)
           
 void setInstalledLocaleIds(String[] installedLocaleIds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

installedLocaleIds

@Inject
protected String[] installedLocaleIds
The list of locales supported.


defaultLocaleId

@Inject
protected String defaultLocaleId
The default localeId.

Constructor Detail

LocaleManager

public LocaleManager()
Method Detail

lookup

public static LocaleManager lookup()

init

@PostConstruct
public void init()

getInstalledLocaleIds

public String[] getInstalledLocaleIds()

setInstalledLocaleIds

public void setInstalledLocaleIds(String[] installedLocaleIds)

getDefaultLocaleId

public String getDefaultLocaleId()

setDefaultLocaleId

public void setDefaultLocaleId(String defaultLocale)

setDefaultLocale

public void setDefaultLocale(Locale defaultLocale)

getLocaleById

public Locale getLocaleById(String localeId)
Get a Locale by its id.

Returns:
a Locale whose toString() equals given localeId, or null if it doesn't exist

getAllLocales

public Locale[] getAllLocales()
Locales supported by the VM


getPlatformAvailableLocales

public Locale[] getPlatformAvailableLocales()
Locales supported by the platform


getCurrentLocale

public Locale getCurrentLocale()
Current locale for viewing contents


setCurrentLocale

public void setCurrentLocale(Locale l)

getPlatformLocale

public Locale getPlatformLocale(Locale l)

getDefaultLocale

public Locale getDefaultLocale()
Default locale for the application


getLanguages

protected String[] getLanguages(Locale[] locales)

getLangDisplayName

public String getLangDisplayName(String lang)
Return the display name (in current locale) of the specified lang


getAllLanguages

public String[] getAllLanguages()
Get all language identifiers


getPlatformAvailableLangs

public String[] getPlatformAvailableLangs()
Langs supported.


getCurrentLang

public String getCurrentLang()
Get the current language for displaying contents


setCurrentLang

public void setCurrentLang(String langId)
Set the current language for displaying contents


getDefaultLang

public String getDefaultLang()
Get the default language for the platform


localize

public Object localize(Map localizedData)
Given a map of locale->value or language->value, it returns the appropriate value for the current locale. If such value doesn't exist, it uses the default locale.

Returns:
Appropriate value for given locale.

currentLocale

public static Locale currentLocale()
Static getter for current Locale.


currentLang

public static String currentLang()
Static getter for current lang.


getBundle

public ResourceBundle getBundle(String baseName)
================================================================== BZ-1031080: RESOURCE BUNDLE CUSTOM HANDLING Use another NoFallbackControl implementation than the default one. ==================================================================


getBundle

public ResourceBundle getBundle(String baseName,
                                Locale targetLocale)

getBundle

public ResourceBundle getBundle(String baseName,
                                Locale targetLocale,
                                ClassLoader loader)

Dashboard Builder Commons 6.2.0.CR3

Copyright © 2012-2014 JBoss by Red Hat. All Rights Reserved.