public class LocalizationUtil extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
WEB_APP_ATTR
Name of the attribute used to store this utility in the zk-webapp.
|
Constructor and Description |
---|
LocalizationUtil()
Constructor that is called by web application init listener.
|
Modifier and Type | Method and Description |
---|---|
String |
coreLocalize(String key)
Localize a core string using the
strings resource bundle. |
String |
coreLocalize(String key,
javax.servlet.http.HttpSession session)
Localize a core string using the
strings resource bundle. |
String |
databaseLocalize(String toLocalize)
Localizes a string for the current client locale using the localize table on the database and
a localizeUtilCache for holding localized Strings in a cache.
|
List<Locale> |
getAllSupportedLocales()
Returns a list of all supported locales as configured in webclient.properties.
|
static Locale |
getCurrentLocale()
Gets the current locale.
|
static Locale |
getCurrentLocale(javax.servlet.http.HttpSession session)
Gets the current locale.
|
static Locale |
getDefaultLocale()
resolve defaultLocale form web.xml.
|
static String |
getDisplayLanguage()
Get current Display Language in english.
|
static LocalizationUtil |
getInstance()
Get LocalizationUtil Instance.
|
static LocalizationUtil |
getInstanceExternal(javax.servlet.ServletContext context)
Get LocalizationUtil Instance.
|
Locale |
getSupportedLocale()
Check if the initial browser Locale or current Locale is one of the supported Locales.If this
Locale is not supported we use the defaultLocale.
|
Locale |
getSupportedLocale(javax.servlet.http.HttpSession session)
Check if the initial browser Locale or current Locale is one of the supported Locales.If this
Locale is not supported we use the defaultLocale.
|
ArrayList<Locale> |
getSupportedLocales()
Deprecated.
use
getAllSupportedLocales() instead. Will be removed in 8.1 |
boolean |
isSupportedLocale(Locale locale)
Checks if the specified locale is supported.
|
static String |
localize(String baseName,
String key,
javax.servlet.http.HttpSession session)
Localize the key with the given localization bundle.
|
String |
localizeFolderPath(String pathToLocalize)
Localizes a folder path.
|
static String |
resolveLocale(Locale locale)
resolve Country and Language from a Locale to a String like "de_DE".
|
static Locale |
resolveLocale(String webLocale)
resolve Country and Language from a Locale String like "de_DE".
|
static ArrayList<String> |
resolveToStringArray(String valuesConcatinated)
Deprecated.
will be removed in 8.1
|
static String |
sessionLocalize(String key)
Returns the session stored messages by the given key if existing.
|
static void |
setCurrentLocale(Locale aLocale) |
static String |
staticWebLocalize(String key)
Localize a string using the
localizations resource bundle. |
String |
webLocalize(String key)
Localize a string using the
localizations resource bundle. |
String |
webLocalize(String key,
javax.servlet.http.HttpSession session)
Localize a string using the
localizations resource bundle. |
public static final String WEB_APP_ATTR
public LocalizationUtil()
public static Locale getCurrentLocale()
public static Locale getCurrentLocale(javax.servlet.http.HttpSession session)
session
- the sessionpublic static void setCurrentLocale(Locale aLocale)
aLocale
- the currentLocale to setpublic static String getDisplayLanguage()
public static LocalizationUtil getInstance()
public static LocalizationUtil getInstanceExternal(javax.servlet.ServletContext context)
context
- current servlet contextpublic String webLocalize(String key)
localizations
resource bundle. Use this method to
localize keys from LocalizationConstants
.key
- Keypublic static String staticWebLocalize(String key)
localizations
resource bundle. Use this method to
localize keys from LocalizationConstants
. Same as webLocalize but accessible
from static methods.key
- Keypublic String webLocalize(String key, javax.servlet.http.HttpSession session)
localizations
resource bundle. Use this method to
localize keys from LocalizationConstants
.key
- Keysession
- the current sessionpublic static String sessionLocalize(String key)
ServiceView.registerSessionAttributes
.key
- The key of the message to retrieve.public String coreLocalize(String key)
strings
resource bundle. Use this method to
localize a key from CoreResources
.key
- Keypublic String coreLocalize(String key, javax.servlet.http.HttpSession session)
strings
resource bundle. Use this method to
localize a key from CoreResources
.key
- Keysession
- the current sessionpublic String databaseLocalize(String toLocalize)
toLocalize
- string to localizepublic static String localize(String baseName, String key, javax.servlet.http.HttpSession session)
baseName
- Bundle namekey
- Keysession
- Sessionpublic String localizeFolderPath(String pathToLocalize)
pathToLocalize
- path to localizepublic static Locale resolveLocale(String webLocale)
webLocale
- webLocalepublic static String resolveLocale(Locale locale)
locale
- locale@Deprecated public static ArrayList<String> resolveToStringArray(String valuesConcatinated)
valuesConcatinated
- valuesConcatinated@Deprecated public ArrayList<Locale> getSupportedLocales()
getAllSupportedLocales()
instead. Will be removed in 8.1public List<Locale> getAllSupportedLocales()
public static Locale getDefaultLocale()
public boolean isSupportedLocale(Locale locale)
locale
- locale to checkpublic Locale getSupportedLocale()
public Locale getSupportedLocale(javax.servlet.http.HttpSession session)
session
- the current sessionCopyright © 2016 Lexmark Enterprise Software Deutschland GmbH. All rights reserved.