Interface I18NService

All Known Implementing Classes:
DefaultI18NService, I18NServiceMock

public interface I18NService
General 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 Details

    • getCurrentLocale

      Locale getCurrentLocale()
      Returns current (session) locale (and not JVM's own locale).
      Returns:
      the current locale
    • setCurrentLocale

      void setCurrentLocale(Locale locale)
      Changes current session locale.
      Parameters:
      locale - the new session locale
    • getSupportedLocales

      Set<Locale> getSupportedLocales()
      Returns:
      a Set of Locales for the current system.
    • getSupportedJavaCurrencies

      Set<Currency> 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

      void setCurrentTimeZone(TimeZone timezone)
      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

      void setCurrentJavaCurrency(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

      Currency getBestMatchingJavaCurrency(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:
      IllegalArgumentException - if currencyCode is not a supported ISO 4217 code.
    • getBestMatchingLocale

      Locale getBestMatchingLocale(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:
      IllegalArgumentException - if no matching locale could be found
    • getAllLocales

      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.
      Parameters:
      locale - the given locale
    • getFallbackLocales

      Locale[] getFallbackLocales(Locale locale)
      Like getAllLocales(Locale locale) but just return the fallbacks themselves
    • getCurrentCurrency

      @Deprecated(since="ages", forRemoval=true) CurrencyModel getCurrentCurrency()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use CommonI18NService.getCurrentCurrency()

      return a CurrencyModel representing the current currency.

      Returns:
      the current currency
    • setCurrentCurrency

      @Deprecated(since="ages", forRemoval=true) void setCurrentCurrency(CurrencyModel currency)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use CommonI18NService.setCurrentCurrency(CurrencyModel)

      Sets the current currency.

      Parameters:
      currency - the new currency
    • getSupportedDataLocales

      @Deprecated(since="ages", forRemoval=true) Set<Locale> getSupportedDataLocales()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use getSupportedLocales()
      Returns:
      a Set of Locales for the current system.
    • getBundle

      @Deprecated(since="ages", forRemoval=true) ResourceBundle getBundle(String baseName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use L10NService.getResourceBundle(String)

      Returns a ResourceBundle which 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 use L10NService.getResourceBundle(String, Locale[])

      Returns a ResourceBundle which supports hybris specific fallback strategies.
      Fallback bundles are fetched according to the passed locales.

      Parameters:
      baseName - bundle name
      locales - 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 use L10NService.getResourceBundle(String, Locale[])

      Returns a ResourceBundle which supports hybris specific fallback strategies.
      Fallback bundles are fetched according the passed locales.

      Parameters:
      baseName - bundle name
      locales - fallback locales (bundles)
      loader - classloader to use
      Returns:
      the bundle
    • getLanguage

      @Deprecated(since="ages", forRemoval=true) LanguageModel 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 use CommonI18NService.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(since="ages", forRemoval=true) Set<LanguageModel> getAllLanguages()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use CommonI18NService.getAllLanguages()

      Gets all languages.

      Returns:
      all languages in the system
    • getAllActiveLanguages

      @Deprecated(since="ages", forRemoval=true) Set<LanguageModel> 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(since="ages", forRemoval=true) CountryModel 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 use CommonI18NService.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(since="ages", forRemoval=true) Set<CountryModel> getAllCountries()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use CommonI18NService.getAllCountries()

      Return a set of all CountryModels.

      Returns:
      the countries
    • getCurrency

      @Deprecated(since="ages", forRemoval=true) CurrencyModel 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 use CommonI18NService.getCurrency(String)

      Return a CurrencyModel pertinent to the isoCode.

      Parameters:
      isoCode - the iso code
      Returns:
      the CurrencyModel for the given isoCode
    • getAllCurrencies

      @Deprecated(since="ages", forRemoval=true) Set<CurrencyModel> getAllCurrencies()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use CommonI18NService.getAllCurrencies()

      Return a set of all CurrencyModels.

      Returns:
      all currencies
    • getBaseCurrency

      @Deprecated(since="ages", forRemoval=true) CurrencyModel getBaseCurrency()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since ages - as of release 4.3, please use CommonI18NService.getBaseCurrency()

      Return a currencyModel representing the base currency.

      Returns:
      the base currency
    • getEnumLocalizedName

      @Deprecated(since="ages", forRemoval=true) String 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 use EnumerationService.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 use EnumerationService.setEnumerationName(HybrisEnumValue, String)

      Changes localized name for enumeration value.

      Parameters:
      enumValue - the value
      name - the new name
    • getLangPKFromLocale

      PK getLangPKFromLocale(Locale locale)
      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