Class DefaultI18NService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.servicelayer.i18n.impl.DefaultI18NService
-
- All Implemented Interfaces:
I18NService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
I18NServiceMock
public class DefaultI18NService extends AbstractBusinessService implements I18NService
Default implementation of the i18n service interface.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultI18NService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Set<LanguageModel>getAllActiveLanguages()Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.util.Set<CountryModel>getAllCountries()Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.util.Set<CurrencyModel>getAllCurrencies()Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.util.Set<LanguageModel>getAllLanguages()Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.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, for removal: This API element is subject to removal in a future version.since agesjava.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, for removal: This API element is subject to removal in a future version.since agesjava.util.ResourceBundlegetBundle(java.lang.String baseName, java.util.Locale[] locales)Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.util.ResourceBundlegetBundle(java.lang.String baseName, java.util.Locale[] locales, java.lang.ClassLoader loader)Deprecated, for removal: This API element is subject to removal in a future version.since agesCountryModelgetCountry(java.lang.String isocode)Deprecated, for removal: This API element is subject to removal in a future version.since agesCurrencyModelgetCurrency(java.lang.String isoCode)Deprecated, for removal: This API element is subject to removal in a future version.since agesCurrencyModelgetCurrentCurrency()Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.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, for removal: This API element is subject to removal in a future version.since agesjava.util.Locale[]getFallbackLocales(java.util.Locale locale)Like getAllLocales(Locale locale) but just return the fallbacks themselvesI18NDaogetI18nDao()Deprecated, for removal: This API element is subject to removal in a future version.since agesPKgetLangPKFromLocale(java.util.Locale locale)Returns proper language PK for matching locale.LanguageModelgetLanguage(java.lang.String isocode)Deprecated, for removal: This API element is subject to removal in a future version.since agesLocalizationServicegetLocaleService()Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.util.Set<java.util.Locale>getSupportedDataLocales()Deprecated, for removal: This API element is subject to removal in a future version.since agesjava.util.Set<java.util.Currency>getSupportedJavaCurrencies()java.util.Set<java.util.Locale>getSupportedLocales()TypeServicegetTypeService()booleanisLocalizationFallbackEnabled()Return the status of the localization fallback flag.TypeServicelookupTypeService()Must be overwritten! Use <lookup-method> in spring.voidsetCurrencyDao(CurrencyDao currencyDao)voidsetCurrentCurrency(CurrencyModel currency)Deprecated, for removal: This API element is subject to removal in a future version.since agesvoidsetCurrentJavaCurrency(java.util.Currency currency)Sets the current currency.voidsetCurrentLocale(java.util.Locale locale)Changes current session locale.voidsetCurrentTimeZone(java.util.TimeZone zone)Changes current session timezone.voidsetEnumLocalizedName(HybrisEnumValue enumValue, java.lang.String name)Deprecated, for removal: This API element is subject to removal in a future version.since agesvoidsetI18nDao(I18NDao dao)Deprecated, for removal: This API element is subject to removal in a future version.since agesvoidsetLocaleService(LocalizationService localeService)Deprecated, for removal: This API element is subject to removal in a future version.since agesvoidsetLocalizationFallbackEnabled(boolean enabled)Set the status of the localization fallback flag.-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
getTypeService
public TypeService getTypeService()
-
lookupTypeService
public TypeService lookupTypeService()
Must be overwritten! Use <lookup-method> in spring.
-
getCurrentJavaCurrency
public java.util.Currency getCurrentJavaCurrency()
Description copied from interface:I18NServicereturn a Currency representing the current currency.- Specified by:
getCurrentJavaCurrencyin interfaceI18NService- Returns:
- the current currency
-
setCurrentJavaCurrency
public void setCurrentJavaCurrency(java.util.Currency currency)
Description copied from interface:I18NServiceSets the current currency.- Specified by:
setCurrentJavaCurrencyin interfaceI18NService- Parameters:
currency- the new currency
-
getCurrentLocale
public final java.util.Locale getCurrentLocale()
Description copied from interface:I18NServiceReturns current (session) locale (and not JVM's own locale).- Specified by:
getCurrentLocalein interfaceI18NService- Returns:
- the current locale
-
setCurrentLocale
public final void setCurrentLocale(java.util.Locale locale)
Description copied from interface:I18NServiceChanges current session locale.- Specified by:
setCurrentLocalein interfaceI18NService- Parameters:
locale- the new session locale
-
setCurrentTimeZone
public void setCurrentTimeZone(java.util.TimeZone zone)
Description copied from interface:I18NServiceChanges current session timezone.- Specified by:
setCurrentTimeZonein interfaceI18NService- Parameters:
zone- the new session timezone
-
getCurrentTimeZone
public java.util.TimeZone getCurrentTimeZone()
Description copied from interface:I18NServiceReturns current (session) timezone (and not JVM's own timezone).- Specified by:
getCurrentTimeZonein interfaceI18NService- Returns:
- the current time zone
-
isLocalizationFallbackEnabled
public boolean isLocalizationFallbackEnabled()
Description copied from interface:I18NServiceReturn the status of the localization fallback flag.The language fallback setting is a session scope setting.
- Specified by:
isLocalizationFallbackEnabledin interfaceI18NService- Returns:
- the status of the localization fallback flag
-
setLocalizationFallbackEnabled
public void setLocalizationFallbackEnabled(boolean enabled)
Description copied from interface:I18NServiceSet the status of the localization fallback flag.The language fallback setting is a session scope setting.
- Specified by:
setLocalizationFallbackEnabledin interfaceI18NService- Parameters:
enabled- true if localization fallback should be activated
-
getBestMatchingJavaCurrency
public java.util.Currency getBestMatchingJavaCurrency(java.lang.String isocode)
Description copied from interface:I18NServiceReturns the Currency instance for the given currency iso code. If not found, null will be returned.- Specified by:
getBestMatchingJavaCurrencyin interfaceI18NService- Parameters:
isocode- the iso code- Returns:
- the Currency instance for the given currency iso code. If not found, null will be returned
-
getAllLocales
public java.util.Locale[] getAllLocales(java.util.Locale locale)
Description copied from interface:I18NServiceReturns 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.- Specified by:
getAllLocalesin interfaceI18NService- Parameters:
locale- the given locale
-
getBestMatchingLocale
public java.util.Locale getBestMatchingLocale(java.util.Locale locale)
Description copied from interface:I18NServiceFor 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.- Specified by:
getBestMatchingLocalein interfaceI18NService- Parameters:
locale- the locale to match
-
getFallbackLocales
public java.util.Locale[] getFallbackLocales(java.util.Locale locale)
Description copied from interface:I18NServiceLike getAllLocales(Locale locale) but just return the fallbacks themselves- Specified by:
getFallbackLocalesin interfaceI18NService
-
getSupportedJavaCurrencies
public java.util.Set<java.util.Currency> getSupportedJavaCurrencies()
- Specified by:
getSupportedJavaCurrenciesin interfaceI18NService- Returns:
- a Set of
Currencys for the current system.
-
getSupportedLocales
public java.util.Set<java.util.Locale> getSupportedLocales()
- Specified by:
getSupportedLocalesin interfaceI18NService- Returns:
- a Set of
Locales for the current system.
-
setCurrencyDao
public void setCurrencyDao(CurrencyDao currencyDao)
-
getLocaleService
@Deprecated(since="ages", forRemoval=true) public LocalizationService getLocaleService()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Returns:
- the localeService
-
setLocaleService
@Deprecated(since="ages", forRemoval=true) public void setLocaleService(LocalizationService localeService)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Parameters:
localeService- the localeService to set
-
getI18nDao
@Deprecated(since="ages", forRemoval=true) public I18NDao getI18nDao()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Returns:
- the i18nDao
-
setI18nDao
@Deprecated(since="ages", forRemoval=true) public void setI18nDao(I18NDao dao)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Parameters:
dao- the i18nDao to set
-
getCurrentCurrency
@Deprecated(since="ages", forRemoval=true) public CurrencyModel getCurrentCurrency()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getCurrentCurrencyin interfaceI18NService- Returns:
- the current currency
-
setCurrentCurrency
@Deprecated(since="ages", forRemoval=true) public void setCurrentCurrency(CurrencyModel currency)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
setCurrentCurrencyin interfaceI18NService- Parameters:
currency- the new currency
-
getLanguage
@Deprecated(since="ages", forRemoval=true) public LanguageModel getLanguage(java.lang.String isocode)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getLanguagein interfaceI18NService- Parameters:
isocode- the isocode a language is searched for- Returns:
- language for searched isocode
-
getAllActiveLanguages
@Deprecated(since="ages", forRemoval=true) public java.util.Set<LanguageModel> getAllActiveLanguages()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getAllActiveLanguagesin interfaceI18NService- Returns:
- all languages where attribute 'active' is set to true
-
getAllLanguages
@Deprecated(since="ages", forRemoval=true) public java.util.Set<LanguageModel> getAllLanguages()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getAllLanguagesin interfaceI18NService- Returns:
- all languages in the system
-
getCountry
@Deprecated(since="ages", forRemoval=true) public CountryModel getCountry(java.lang.String isocode)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getCountryin interfaceI18NService- Parameters:
isocode- the isocode- Returns:
- the country
-
getAllCountries
@Deprecated(since="ages", forRemoval=true) public java.util.Set<CountryModel> getAllCountries()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getAllCountriesin interfaceI18NService- Returns:
- the countries
-
getAllCurrencies
@Deprecated(since="ages", forRemoval=true) public java.util.Set<CurrencyModel> getAllCurrencies()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getAllCurrenciesin interfaceI18NService- Returns:
- all currencies
-
getBaseCurrency
@Deprecated(since="ages", forRemoval=true) public CurrencyModel getBaseCurrency()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getBaseCurrencyin interfaceI18NService- Returns:
- the base currency
-
getCurrency
@Deprecated(since="ages", forRemoval=true) public CurrencyModel getCurrency(java.lang.String isoCode)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getCurrencyin interfaceI18NService- Parameters:
isoCode- the iso code- Returns:
- the CurrencyModel for the given isoCode
-
getSupportedDataLocales
@Deprecated(since="ages", forRemoval=true) public java.util.Set<java.util.Locale> getSupportedDataLocales()Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getSupportedDataLocalesin interfaceI18NService- Returns:
- a Set of
Locales for the current system.
-
getBundle
@Deprecated(since="ages", forRemoval=true) public java.util.ResourceBundle getBundle(java.lang.String baseName)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getBundlein interfaceI18NService- Parameters:
baseName- bundle name- Returns:
- the bundle
-
getBundle
@Deprecated(since="ages", forRemoval=true) public java.util.ResourceBundle getBundle(java.lang.String baseName, java.util.Locale[] locales)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getBundlein interfaceI18NService- Parameters:
baseName- bundle namelocales- fallback locales (bundles)- Returns:
- the bundle
-
getBundle
@Deprecated(since="ages", forRemoval=true) public java.util.ResourceBundle getBundle(java.lang.String baseName, java.util.Locale[] locales, java.lang.ClassLoader loader)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getBundlein interfaceI18NService- Parameters:
baseName- bundle namelocales- fallback locales (bundles)loader- classloader to use- Returns:
- the bundle
-
getEnumLocalizedName
@Deprecated(since="ages", forRemoval=true) public java.lang.String getEnumLocalizedName(HybrisEnumValue enumValue)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getEnumLocalizedNamein interfaceI18NService- Parameters:
enumValue- the value- Returns:
- the enum localized name
-
setEnumLocalizedName
@Deprecated(since="ages", forRemoval=true) public void setEnumLocalizedName(HybrisEnumValue enumValue, java.lang.String name)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
setEnumLocalizedNamein interfaceI18NService- Parameters:
enumValue- the valuename- the new name
-
getLangPKFromLocale
public PK getLangPKFromLocale(java.util.Locale locale)
Description copied from interface:I18NServiceReturns proper language PK for matching locale.- Specified by:
getLangPKFromLocalein interfaceI18NService- Parameters:
locale- the locale to get data language code for- Returns:
- language pk
-
-