Class Localization


  • public class Localization
    extends java.lang.Object
    Helper class for localization handling.
    • Constructor Summary

      Constructors 
      Constructor Description
      Localization()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<Language,​java.lang.String> getLocalizedMap​(java.lang.String key)
      Returns a map which can be used as a parameter for setAllNames() of any localized item.
      static java.lang.String getLocalizedString​(java.lang.String key)
      Return the localization of an given key and the current session language.
      static java.lang.String getLocalizedString​(java.lang.String key, java.lang.Object[] arguments)
      Return the localization of an given key and the current session language.
      • Methods inherited from class java.lang.Object

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

      • Localization

        public Localization()
    • Method Detail

      • getLocalizedString

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

        public static java.lang.String getLocalizedString​(java.lang.String key)
        Return the localization of an given key and the current session language.
        Parameters:
        key - the key
        Returns:
        the localized string
      • getLocalizedMap

        public static java.util.Map<Language,​java.lang.String> getLocalizedMap​(java.lang.String key)
        Returns a map which can be used as a parameter for setAllNames() of any localized item.

        e.g. product.setAllNames( Localization.getLocalizedMap("myitemkey") );
        or locItem.setLocalizedProperty( sess_ctx_with_language_null, key, Localization.getLocalizedMap("myitemkey") );

        Parameters:
        key - the which can be found in the localization files
        Returns:
        the map