Class UserI18NTranslationMap

    • Constructor Detail

      • UserI18NTranslationMap

        public UserI18NTranslationMap()
      • UserI18NTranslationMap

        public UserI18NTranslationMap​(Map<String,​String> other)
    • Method Detail

      • get

        public String get​(Object language)
        Gets the translation corresponding to given language.

        If it does not exist a translation for the given language, then a default one is retrieved by checking translation existence of handled languages. In a such case, the first existing translation is considered as default.

        If default translation is not needed, then check availability with containsKey(Object) before.

        Specified by:
        get in interface Map<String,​String>
        Overrides:
        get in class HashMap<String,​String>
        Parameters:
        language - instance representing the language.
        Returns:
        a string corresponding to the translation of given language, or a default translation if none. Empty string if it does not exist at least one translation.
      • put

        public String put​(String language,
                          String translation)
        Puts a translation for a language.

        If the translation is not defined, then the language translation entry is removed.

        Specified by:
        put in interface Map<String,​String>
        Overrides:
        put in class HashMap<String,​String>
        Parameters:
        language - key with which the specified value is to be associated
        translation - value to be associated with the specified key
        Returns:
        the resulting of Map.put(Object, Object) if translation is defined, or the resulting of Map.remove(Object) otherwise.