Class DefaultI18NService

All Implemented Interfaces:
I18NService, 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:
  • Constructor Details

    • DefaultI18NService

      public DefaultI18NService()
  • Method Details

    • getTypeService

      public TypeService getTypeService()
    • lookupTypeService

      public TypeService lookupTypeService()
      Must be overwritten! Use <lookup-method> in spring.
    • getCurrentJavaCurrency

      public Currency getCurrentJavaCurrency()
      Description copied from interface: I18NService
      return a Currency representing the current currency.
      Specified by:
      getCurrentJavaCurrency in interface I18NService
      Returns:
      the current currency
    • setCurrentJavaCurrency

      public void setCurrentJavaCurrency(Currency currency)
      Description copied from interface: I18NService
      Sets the current currency.
      Specified by:
      setCurrentJavaCurrency in interface I18NService
      Parameters:
      currency - the new currency
    • getCurrentLocale

      public final Locale getCurrentLocale()
      Description copied from interface: I18NService
      Returns current (session) locale (and not JVM's own locale).
      Specified by:
      getCurrentLocale in interface I18NService
      Returns:
      the current locale
    • setCurrentLocale

      public final void setCurrentLocale(Locale locale)
      Description copied from interface: I18NService
      Changes current session locale.
      Specified by:
      setCurrentLocale in interface I18NService
      Parameters:
      locale - the new session locale
    • setCurrentTimeZone

      public void setCurrentTimeZone(TimeZone zone)
      Description copied from interface: I18NService
      Changes current session timezone.
      Specified by:
      setCurrentTimeZone in interface I18NService
      Parameters:
      zone - the new session timezone
    • getCurrentTimeZone

      public TimeZone getCurrentTimeZone()
      Description copied from interface: I18NService
      Returns current (session) timezone (and not JVM's own timezone).
      Specified by:
      getCurrentTimeZone in interface I18NService
      Returns:
      the current time zone
    • isLocalizationFallbackEnabled

      public boolean isLocalizationFallbackEnabled()
      Description copied from interface: I18NService
      Return the status of the localization fallback flag.

      The language fallback setting is a session scope setting.

      Specified by:
      isLocalizationFallbackEnabled in interface I18NService
      Returns:
      the status of the localization fallback flag
    • setLocalizationFallbackEnabled

      public void setLocalizationFallbackEnabled(boolean enabled)
      Description copied from interface: I18NService
      Set the status of the localization fallback flag.

      The language fallback setting is a session scope setting.

      Specified by:
      setLocalizationFallbackEnabled in interface I18NService
      Parameters:
      enabled - true if localization fallback should be activated
    • getBestMatchingJavaCurrency

      public Currency getBestMatchingJavaCurrency(String isocode)
      Description copied from interface: I18NService
      Returns the Currency instance for the given currency iso code. If not found, null will be returned.
      Specified by:
      getBestMatchingJavaCurrency in interface I18NService
      Parameters:
      isocode - the iso code
      Returns:
      the Currency instance for the given currency iso code. If not found, null will be returned
    • getAllLocales

      public Locale[] getAllLocales(Locale locale)
      Description copied from interface: I18NService
      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.
      Specified by:
      getAllLocales in interface I18NService
      Parameters:
      locale - the given locale
    • getBestMatchingLocale

      public Locale getBestMatchingLocale(Locale locale)
      Description copied from interface: I18NService
      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.
      Specified by:
      getBestMatchingLocale in interface I18NService
      Parameters:
      locale - the locale to match
    • getFallbackLocales

      public Locale[] getFallbackLocales(Locale locale)
      Description copied from interface: I18NService
      Like getAllLocales(Locale locale) but just return the fallbacks themselves
      Specified by:
      getFallbackLocales in interface I18NService
    • getSupportedJavaCurrencies

      public Set<Currency> getSupportedJavaCurrencies()
      Specified by:
      getSupportedJavaCurrencies in interface I18NService
      Returns:
      a Set of Currencys for the current system.
    • getSupportedLocales

      public Set<Locale> getSupportedLocales()
      Specified by:
      getSupportedLocales in interface I18NService
      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:
      getCurrentCurrency in interface I18NService
      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:
      setCurrentCurrency in interface I18NService
      Parameters:
      currency - the new currency
    • getLanguage

      @Deprecated(since="ages", forRemoval=true) public LanguageModel getLanguage(String isocode)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getLanguage in interface I18NService
      Parameters:
      isocode - the isocode a language is searched for
      Returns:
      language for searched isocode
    • getAllActiveLanguages

      @Deprecated(since="ages", forRemoval=true) public Set<LanguageModel> getAllActiveLanguages()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getAllActiveLanguages in interface I18NService
      Returns:
      all languages where attribute 'active' is set to true
    • getAllLanguages

      @Deprecated(since="ages", forRemoval=true) public Set<LanguageModel> getAllLanguages()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getAllLanguages in interface I18NService
      Returns:
      all languages in the system
    • getCountry

      @Deprecated(since="ages", forRemoval=true) public CountryModel getCountry(String isocode)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getCountry in interface I18NService
      Parameters:
      isocode - the isocode
      Returns:
      the country
    • getAllCountries

      @Deprecated(since="ages", forRemoval=true) public Set<CountryModel> getAllCountries()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getAllCountries in interface I18NService
      Returns:
      the countries
    • getAllCurrencies

      @Deprecated(since="ages", forRemoval=true) public Set<CurrencyModel> getAllCurrencies()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getAllCurrencies in interface I18NService
      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:
      getBaseCurrency in interface I18NService
      Returns:
      the base currency
    • getCurrency

      @Deprecated(since="ages", forRemoval=true) public CurrencyModel getCurrency(String isoCode)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getCurrency in interface I18NService
      Parameters:
      isoCode - the iso code
      Returns:
      the CurrencyModel for the given isoCode
    • getSupportedDataLocales

      @Deprecated(since="ages", forRemoval=true) public Set<Locale> getSupportedDataLocales()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getSupportedDataLocales in interface I18NService
      Returns:
      a Set of Locales for the current system.
    • getBundle

      @Deprecated(since="ages", forRemoval=true) public ResourceBundle getBundle(String baseName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getBundle in interface I18NService
      Parameters:
      baseName - bundle name
      Returns:
      the bundle
    • getBundle

      @Deprecated(since="ages", forRemoval=true) public ResourceBundle getBundle(String baseName, Locale[] locales)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getBundle in interface I18NService
      Parameters:
      baseName - bundle name
      locales - fallback locales (bundles)
      Returns:
      the bundle
    • getBundle

      @Deprecated(since="ages", forRemoval=true) public ResourceBundle getBundle(String baseName, Locale[] locales, ClassLoader loader)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getBundle in interface I18NService
      Parameters:
      baseName - bundle name
      locales - fallback locales (bundles)
      loader - classloader to use
      Returns:
      the bundle
    • getEnumLocalizedName

      @Deprecated(since="ages", forRemoval=true) public String getEnumLocalizedName(HybrisEnumValue enumValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      getEnumLocalizedName in interface I18NService
      Parameters:
      enumValue - the value
      Returns:
      the enum localized name
    • setEnumLocalizedName

      @Deprecated(since="ages", forRemoval=true) public void setEnumLocalizedName(HybrisEnumValue enumValue, String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages
      Specified by:
      setEnumLocalizedName in interface I18NService
      Parameters:
      enumValue - the value
      name - the new name
    • getLangPKFromLocale

      public PK getLangPKFromLocale(Locale locale)
      Description copied from interface: I18NService
      Returns proper language PK for matching locale.
      Specified by:
      getLangPKFromLocale in interface I18NService
      Parameters:
      locale - the locale to get data language code for
      Returns:
      language pk