Class DefaultL10NService

  • All Implemented Interfaces:
    L10NService

    public class DefaultL10NService
    extends java.lang.Object
    implements L10NService
    Default implementation of the l10n service interface.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.Map<java.util.Locale,​java.util.Properties> getLocalizations()  
      java.lang.String getLocalizedString​(java.lang.String resKey)
      Return the localization of an given key and the current session language.
      java.lang.String getLocalizedString​(java.lang.String resKey, java.lang.Object[] arguments)
      Return the localization of an given key and the current session language.
      java.util.ResourceBundle getResourceBundle()
      Returns a ResourceBundle for all type localizations which supports hybris specific fallback strategies.
      The fallback bundles are fetched according to the current session Language.
      java.util.ResourceBundle getResourceBundle​(java.lang.String baseName)
      Returns a ResourceBundle for a given base name.
      java.util.ResourceBundle getResourceBundle​(java.lang.String baseName, java.util.Locale[] locales)
      Returns a ResourceBundle for a given base name.
      java.util.ResourceBundle getResourceBundle​(java.util.Locale[] locales)
      Returns a ResourceBundle for all type localizations.
      void setCommonI18NService​(CommonI18NService commonI18NService)  
      void setI18nService​(I18NService i18nService)  
      void setModelService​(ModelService modelService)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultL10NService

        public DefaultL10NService()
    • Method Detail

      • getResourceBundle

        public java.util.ResourceBundle getResourceBundle()
        Description copied from interface: L10NService
        Returns a ResourceBundle for all type localizations which supports hybris specific fallback strategies.
        The fallback bundles are fetched according to the current session Language.
        Specified by:
        getResourceBundle in interface L10NService
        Returns:
        the bundle
      • getLocalizations

        protected java.util.Map<java.util.Locale,​java.util.Properties> getLocalizations()
        Returns:
        localization map where key is a Locale, and value is a instance of Properties
      • getResourceBundle

        public java.util.ResourceBundle getResourceBundle​(java.util.Locale[] locales)
        Description copied from interface: L10NService
        Returns a ResourceBundle for all type localizations. The resource bundle supports hybris specific fallback strategies.
        Fallback bundles are fetched according to the passed locales.
        Specified by:
        getResourceBundle in interface L10NService
        Parameters:
        locales - fallback locales (bundles)
        Returns:
        the bundle
      • getLocalizedString

        public java.lang.String getLocalizedString​(java.lang.String resKey,
                                                   java.lang.Object[] arguments)
        Description copied from interface: L10NService
        Return the localization of an given key and the current session language. The localized string will be processed by MessageFormat using given arguments.
        Specified by:
        getLocalizedString in interface L10NService
        Parameters:
        resKey - the resource key
        arguments - list of values for the text arguments (see MessageFormat.format(String, Object[]))
        Returns:
        the localized string
      • getLocalizedString

        public java.lang.String getLocalizedString​(java.lang.String resKey)
        Description copied from interface: L10NService
        Return the localization of an given key and the current session language.
        Specified by:
        getLocalizedString in interface L10NService
        Parameters:
        resKey - the key
        Returns:
        the localized string
      • getResourceBundle

        public java.util.ResourceBundle getResourceBundle​(java.lang.String baseName)
        Description copied from interface: L10NService
        Returns a ResourceBundle for a given base name. The resource bundle supports hybris specific fallback strategies.
        The fallback bundles are fetched according to the current session Language.
        Specified by:
        getResourceBundle in interface L10NService
        Parameters:
        baseName - bundle name
        Returns:
        the bundle
      • getResourceBundle

        public java.util.ResourceBundle getResourceBundle​(java.lang.String baseName,
                                                          java.util.Locale[] locales)
        Description copied from interface: L10NService
        Returns a ResourceBundle for a given base name. The resource bundle supports hybris specific fallback strategies.
        Fallback bundles are fetched according to the passed locales.
        Specified by:
        getResourceBundle in interface L10NService
        Parameters:
        baseName - bundle name
        locales - fallback locales (bundles)
        Returns:
        the bundle
      • setI18nService

        public void setI18nService​(I18NService i18nService)
      • setCommonI18NService

        public void setCommonI18NService​(CommonI18NService commonI18NService)
      • setModelService

        public void setModelService​(ModelService modelService)