Interface I18NService
-
- All Known Implementing Classes:
DefaultI18NService,I18NServiceMock
public interface I18NServiceGeneral i18n service methods which can be used to "bridge" between hybris internationalization and plain Java API (Locale,TimeZone,Currency). See DevNet page "Internationalization and Localization".- Since:
- 4.3
- Spring Bean ID:
- i18nService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.util.Set<LanguageModel>getAllActiveLanguages()Deprecated.since ages - as of release 4.3, please use)java.util.Set<CountryModel>getAllCountries()Deprecated.since ages - as of release 4.3, please useCommonI18NService.getAllCountries()java.util.Set<CurrencyModel>getAllCurrencies()Deprecated.since ages - as of release 4.3, please useCommonI18NService.getAllCurrencies()java.util.Set<LanguageModel>getAllLanguages()Deprecated.since ages - as of release 4.3, please useCommonI18NService.getAllLanguages()java.util.Locale[]getAllLocales(java.util.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.CurrencyModelgetBaseCurrency()Deprecated.since ages - as of release 4.3, please useCommonI18NService.getBaseCurrency()java.util.CurrencygetBestMatchingJavaCurrency(java.lang.String isocode)Returns the Currency instance for the given currency iso code.java.util.LocalegetBestMatchingLocale(java.util.Locale locale)For a given locale this method tries to find a matching locale which is backed by a hybris language item.java.util.ResourceBundlegetBundle(java.lang.String baseName)Deprecated.since ages - as of release 4.3, please useL10NService.getResourceBundle(String)java.util.ResourceBundlegetBundle(java.lang.String baseName, java.util.Locale[] locales)Deprecated.since ages - as of release 4.3, please useL10NService.getResourceBundle(String, Locale[])java.util.ResourceBundlegetBundle(java.lang.String baseName, java.util.Locale[] locales, java.lang.ClassLoader loader)Deprecated.since ages - as of release 4.3, please useL10NService.getResourceBundle(String, Locale[])CountryModelgetCountry(java.lang.String isocode)Deprecated.since ages - as of release 4.3, please useCommonI18NService.getCountry(String)CurrencyModelgetCurrency(java.lang.String isoCode)Deprecated.since ages - as of release 4.3, please useCommonI18NService.getCurrency(String)CurrencyModelgetCurrentCurrency()Deprecated.since ages - as of release 4.3, please useCommonI18NService.getCurrentCurrency()java.util.CurrencygetCurrentJavaCurrency()return a Currency representing the current currency.java.util.LocalegetCurrentLocale()Returns current (session) locale (and not JVM's own locale).java.util.TimeZonegetCurrentTimeZone()Returns current (session) timezone (and not JVM's own timezone).java.lang.StringgetEnumLocalizedName(HybrisEnumValue enumValue)Deprecated.since ages - as of release 4.3, please useEnumerationService.getEnumerationName(HybrisEnumValue)java.util.Locale[]getFallbackLocales(java.util.Locale locale)Like getAllLocales(Locale locale) but just return the fallbacks themselvesPKgetLangPKFromLocale(java.util.Locale locale)Returns proper language PK for matching locale.LanguageModelgetLanguage(java.lang.String isocode)Deprecated.since ages - as of release 4.3, please useCommonI18NService.getLanguage(String)java.util.Set<java.util.Locale>getSupportedDataLocales()Deprecated.since ages - as of release 4.3, please usegetSupportedLocales()java.util.Set<java.util.Currency>getSupportedJavaCurrencies()java.util.Set<java.util.Locale>getSupportedLocales()booleanisLocalizationFallbackEnabled()Return the status of the localization fallback flag.voidsetCurrentCurrency(CurrencyModel currency)Deprecated.since ages - as of release 4.3, please useCommonI18NService.setCurrentCurrency(CurrencyModel)voidsetCurrentJavaCurrency(java.util.Currency currency)Sets the current currency.voidsetCurrentLocale(java.util.Locale locale)Changes current session locale.voidsetCurrentTimeZone(java.util.TimeZone timezone)Changes current session timezone.voidsetEnumLocalizedName(HybrisEnumValue enumValue, java.lang.String name)Deprecated.since ages - as of release 4.3, please useEnumerationService.setEnumerationName(HybrisEnumValue, String)voidsetLocalizationFallbackEnabled(boolean enabled)Set the status of the localization fallback flag.
-
-
-
Method Detail
-
getCurrentLocale
java.util.Locale getCurrentLocale()
Returns current (session) locale (and not JVM's own locale).- Returns:
- the current locale
-
setCurrentLocale
void setCurrentLocale(java.util.Locale locale)
Changes current session locale.- Parameters:
locale- the new session locale
-
getSupportedLocales
java.util.Set<java.util.Locale> getSupportedLocales()
- Returns:
- a Set of
Locales for the current system.
-
getSupportedJavaCurrencies
java.util.Set<java.util.Currency> getSupportedJavaCurrencies()
- Returns:
- a Set of
Currencys for the current system.
-
getCurrentTimeZone
java.util.TimeZone getCurrentTimeZone()
Returns current (session) timezone (and not JVM's own timezone).- Returns:
- the current time zone
-
setCurrentTimeZone
void setCurrentTimeZone(java.util.TimeZone timezone)
Changes current session timezone.- Parameters:
timezone- the new session timezone
-
getCurrentJavaCurrency
java.util.Currency getCurrentJavaCurrency()
return a Currency representing the current currency.- Returns:
- the current currency
-
setCurrentJavaCurrency
void setCurrentJavaCurrency(java.util.Currency currency)
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
java.util.Currency getBestMatchingJavaCurrency(java.lang.String isocode)
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:
java.lang.IllegalArgumentException- if currencyCode is not a supported ISO 4217 code.
-
getBestMatchingLocale
java.util.Locale getBestMatchingLocale(java.util.Locale locale)
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:
java.lang.IllegalArgumentException- if no matching locale could be found
-
getAllLocales
java.util.Locale[] getAllLocales(java.util.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.- Parameters:
locale- the given locale
-
getFallbackLocales
java.util.Locale[] getFallbackLocales(java.util.Locale locale)
Like getAllLocales(Locale locale) but just return the fallbacks themselves
-
getCurrentCurrency
@Deprecated CurrencyModel getCurrentCurrency()
Deprecated.since ages - as of release 4.3, please useCommonI18NService.getCurrentCurrency()return a CurrencyModel representing the current currency.
- Returns:
- the current currency
-
setCurrentCurrency
@Deprecated void setCurrentCurrency(CurrencyModel currency)
Deprecated.since ages - as of release 4.3, please useCommonI18NService.setCurrentCurrency(CurrencyModel)Sets the current currency.
- Parameters:
currency- the new currency
-
getSupportedDataLocales
@Deprecated java.util.Set<java.util.Locale> getSupportedDataLocales()
Deprecated.since ages - as of release 4.3, please usegetSupportedLocales()- Returns:
- a Set of
Locales for the current system.
-
getBundle
@Deprecated java.util.ResourceBundle getBundle(java.lang.String baseName)
Deprecated.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 java.util.ResourceBundle getBundle(java.lang.String baseName, java.util.Locale[] locales)Deprecated.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 java.util.ResourceBundle getBundle(java.lang.String baseName, java.util.Locale[] locales, java.lang.ClassLoader loader)Deprecated.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 LanguageModel getLanguage(java.lang.String isocode)
Deprecated.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 java.util.Set<LanguageModel> getAllLanguages()
Deprecated.since ages - as of release 4.3, please useCommonI18NService.getAllLanguages()Gets all languages.
- Returns:
- all languages in the system
-
getAllActiveLanguages
@Deprecated java.util.Set<LanguageModel> getAllActiveLanguages()
Deprecated.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 CountryModel getCountry(java.lang.String isocode)
Deprecated.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 java.util.Set<CountryModel> getAllCountries()
Deprecated.since ages - as of release 4.3, please useCommonI18NService.getAllCountries()Return a set of all CountryModels.
- Returns:
- the countries
-
getCurrency
@Deprecated CurrencyModel getCurrency(java.lang.String isoCode)
Deprecated.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 java.util.Set<CurrencyModel> getAllCurrencies()
Deprecated.since ages - as of release 4.3, please useCommonI18NService.getAllCurrencies()Return a set of all CurrencyModels.
- Returns:
- all currencies
-
getBaseCurrency
@Deprecated CurrencyModel getBaseCurrency()
Deprecated.since ages - as of release 4.3, please useCommonI18NService.getBaseCurrency()Return a currencyModel representing the base currency.
- Returns:
- the base currency
-
getEnumLocalizedName
@Deprecated java.lang.String getEnumLocalizedName(HybrisEnumValue enumValue)
Deprecated.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 void setEnumLocalizedName(HybrisEnumValue enumValue, java.lang.String name)
Deprecated.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
PK getLangPKFromLocale(java.util.Locale locale)
Returns proper language PK for matching locale.- Parameters:
locale- the locale to get data language code for- Returns:
- language pk
- Throws:
java.lang.IllegalArgumentException- when matching DataLocale cannot be find
-
-