Class LocalizedText

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<Locale,String>
de.digitalcollections.model.text.LocalizedText
All Implemented Interfaces:
Serializable, Cloneable, Map<Locale,String>

public class LocalizedText extends HashMap<Locale,String>
LocalizedText is used for unformatted text content in multiple languages.
See Also:
  • Constructor Details

    • LocalizedText

      public LocalizedText()
    • LocalizedText

      public LocalizedText(Locale locale, String text)
  • Method Details

    • getLocales

      public List<Locale> getLocales()
      Returns:
      all locales for which translated texts are available.
    • getText

      public String getText()
      Returns:
      first found text
    • getText

      public String getText(Locale locale)
      Parameters:
      locale - the desired locale.
      Returns:
      text with the given locale
    • has

      public boolean has(Locale locale)
    • setText

      public void setText(Locale locale, String text)
      sets (means: "add" or "replace") a text with a given locale
      Parameters:
      locale - the locale of text
      text - the text content
    • builder

      public static LocalizedText.Builder builder()
    • toString

      public String toString()
      Overrides:
      toString in class AbstractMap<Locale,String>