Class 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
    • Constructor Detail

      • DefaultI18NService

        public DefaultI18NService()
    • Method Detail

      • lookupTypeService

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

        public java.util.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​(java.util.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 java.util.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​(java.util.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​(java.util.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 java.util.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 java.util.Currency getBestMatchingJavaCurrency​(java.lang.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 java.util.Locale[] getAllLocales​(java.util.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 java.util.Locale getBestMatchingLocale​(java.util.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 java.util.Locale[] getFallbackLocales​(java.util.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 java.util.Set<java.util.Currency> getSupportedJavaCurrencies()
        Specified by:
        getSupportedJavaCurrencies in interface I18NService
        Returns:
        a Set of Currencys for the current system.
      • getSupportedLocales

        public java.util.Set<java.util.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​(java.lang.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 java.util.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 java.util.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​(java.lang.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 java.util.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 java.util.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​(java.lang.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 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:
        getSupportedDataLocales in interface I18NService
        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:
        getBundle in interface I18NService
        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:
        getBundle in interface I18NService
        Parameters:
        baseName - bundle name
        locales - 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:
        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 java.lang.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,
                                         java.lang.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​(java.util.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