Interface I18NService
- All Known Implementing Classes:
DefaultI18NService,I18NServiceMock
Locale, TimeZone, Currency). See DevNet page "Internationalization and Localization".- Since:
- 4.3
- Spring Bean ID:
- i18nService
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getAllCountries()Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getAllCurrencies()Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getAllLanguages()Locale[]getAllLocales(Locale locale) Returns a collection of Locales for the passed Locale(Language).
Each Locale element only contains language information and gets constructed from the fallback languages of the passed language.Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getBaseCurrency()getBestMatchingJavaCurrency(String isocode) Returns the Currency instance for the given currency iso code.getBestMatchingLocale(Locale locale) For a given locale this method tries to find a matching locale which is backed by a hybris language item.Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useL10NService.getResourceBundle(String)Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useL10NService.getResourceBundle(String, Locale[])getBundle(String baseName, Locale[] locales, ClassLoader loader) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useL10NService.getResourceBundle(String, Locale[])getCountry(String isocode) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getCountry(String)getCurrency(String isoCode) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getCurrency(String)Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getCurrentCurrency()return a Currency representing the current currency.Returns current (session) locale (and not JVM's own locale).Returns current (session) timezone (and not JVM's own timezone).getEnumLocalizedName(HybrisEnumValue enumValue) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useEnumerationService.getEnumerationName(HybrisEnumValue)Locale[]getFallbackLocales(Locale locale) Like getAllLocales(Locale locale) but just return the fallbacks themselvesgetLangPKFromLocale(Locale locale) Returns proper language PK for matching locale.getLanguage(String isocode) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getLanguage(String)Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please usegetSupportedLocales()booleanReturn the status of the localization fallback flag.voidsetCurrentCurrency(CurrencyModel currency) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.setCurrentCurrency(CurrencyModel)voidsetCurrentJavaCurrency(Currency currency) Sets the current currency.voidsetCurrentLocale(Locale locale) Changes current session locale.voidsetCurrentTimeZone(TimeZone timezone) Changes current session timezone.voidsetEnumLocalizedName(HybrisEnumValue enumValue, String name) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useEnumerationService.setEnumerationName(HybrisEnumValue, String)voidsetLocalizationFallbackEnabled(boolean enabled) Set the status of the localization fallback flag.
-
Method Details
-
getCurrentLocale
Locale getCurrentLocale()Returns current (session) locale (and not JVM's own locale).- Returns:
- the current locale
-
setCurrentLocale
Changes current session locale.- Parameters:
locale- the new session locale
-
getSupportedLocales
- Returns:
- a Set of
Locales for the current system.
-
getSupportedJavaCurrencies
- Returns:
- a Set of
Currencys for the current system.
-
getCurrentTimeZone
TimeZone getCurrentTimeZone()Returns current (session) timezone (and not JVM's own timezone).- Returns:
- the current time zone
-
setCurrentTimeZone
Changes current session timezone.- Parameters:
timezone- the new session timezone
-
getCurrentJavaCurrency
Currency getCurrentJavaCurrency()return a Currency representing the current currency.- Returns:
- the current currency
-
setCurrentJavaCurrency
Sets the current currency.- Parameters:
currency- the new currency
-
isLocalizationFallbackEnabled
boolean isLocalizationFallbackEnabled()Return the status of the localization fallback flag.The language fallback setting is a session scope setting.
- Returns:
- the status of the localization fallback flag
-
setLocalizationFallbackEnabled
void setLocalizationFallbackEnabled(boolean enabled) Set the status of the localization fallback flag.The language fallback setting is a session scope setting.
- Parameters:
enabled- true if localization fallback should be activated
-
getBestMatchingJavaCurrency
Returns the Currency instance for the given currency iso code. If not found, null will be returned.- Parameters:
isocode- the iso code- Returns:
- the Currency instance for the given currency iso code. If not found, null will be returned
- Throws:
IllegalArgumentException- if currencyCode is not a supported ISO 4217 code.
-
getBestMatchingLocale
For a given locale this method tries to find a matching locale which is backed by a hybris language item. If the given locale has got country and or variant part and no language can be found for the complete locale the method tries to find a matching locale without variant and, at last, without country. In case not even the language part can be matched a exception is raised since the given locale cannot be used as data locale at all.- Parameters:
locale- the locale to match- Throws:
IllegalArgumentException- if no matching locale could be found
-
getAllLocales
Returns a collection of Locales for the passed Locale(Language).
Each Locale element only contains language information and gets constructed from the fallback languages of the passed language.- Parameters:
locale- the given locale
-
getFallbackLocales
Like getAllLocales(Locale locale) but just return the fallbacks themselves -
getCurrentCurrency
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getCurrentCurrency()return a CurrencyModel representing the current currency.
- Returns:
- the current currency
-
setCurrentCurrency
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.setCurrentCurrency(CurrencyModel)Sets the current currency.
- Parameters:
currency- the new currency
-
getSupportedDataLocales
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please usegetSupportedLocales()- Returns:
- a Set of
Locales for the current system.
-
getBundle
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useL10NService.getResourceBundle(String)Returns a
ResourceBundlewhich supports hybris specific fallback strategies.
The fallback bundles are fetched according to the current session Language.- Parameters:
baseName- bundle name- Returns:
- the bundle
-
getBundle
@Deprecated(since="ages", forRemoval=true) ResourceBundle getBundle(String baseName, Locale[] locales) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useL10NService.getResourceBundle(String, Locale[])Returns a
ResourceBundlewhich supports hybris specific fallback strategies.
Fallback bundles are fetched according to the passed locales.- Parameters:
baseName- bundle namelocales- fallback locales (bundles)- Returns:
- the bundle
-
getBundle
@Deprecated(since="ages", forRemoval=true) ResourceBundle getBundle(String baseName, Locale[] locales, ClassLoader loader) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useL10NService.getResourceBundle(String, Locale[])Returns a
ResourceBundlewhich supports hybris specific fallback strategies.
Fallback bundles are fetched according the passed locales.- Parameters:
baseName- bundle namelocales- fallback locales (bundles)loader- classloader to use- Returns:
- the bundle
-
getLanguage
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getLanguage(String)Gets the language for the given isocode.
- Parameters:
isocode- the isocode a language is searched for- Returns:
- language for searched isocode
- Throws:
UnknownIdentifierException- if the language with given isocode is not found
-
getAllLanguages
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getAllLanguages()Gets all languages.
- Returns:
- all languages in the system
-
getAllActiveLanguages
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please use)Gets all active languages.
- Returns:
- all languages where attribute 'active' is set to true
-
getCountry
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getCountry(String)Returns a country by it's iso code.
- Parameters:
isocode- the isocode- Returns:
- the country
- Throws:
UnknownIdentifierException- in case no country can be found
-
getAllCountries
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getAllCountries()Return a set of all CountryModels.
- Returns:
- the countries
-
getCurrency
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getCurrency(String)Return a CurrencyModel pertinent to the isoCode.
- Parameters:
isoCode- the iso code- Returns:
- the CurrencyModel for the given isoCode
-
getAllCurrencies
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getAllCurrencies()Return a set of all CurrencyModels.
- Returns:
- all currencies
-
getBaseCurrency
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useCommonI18NService.getBaseCurrency()Return a currencyModel representing the base currency.
- Returns:
- the base currency
-
getEnumLocalizedName
Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useEnumerationService.getEnumerationName(HybrisEnumValue)Provides localized name for enumeration value.
- Parameters:
enumValue- the value- Returns:
- the enum localized name
-
setEnumLocalizedName
@Deprecated(since="ages", forRemoval=true) void setEnumLocalizedName(HybrisEnumValue enumValue, String name) Deprecated, for removal: This API element is subject to removal in a future version.since ages - as of release 4.3, please useEnumerationService.setEnumerationName(HybrisEnumValue, String)Changes localized name for enumeration value.
- Parameters:
enumValue- the valuename- the new name
-
getLangPKFromLocale
Returns proper language PK for matching locale.- Parameters:
locale- the locale to get data language code for- Returns:
- language pk
- Throws:
IllegalArgumentException- when matching DataLocale cannot be find
-
)