Class Translation

java.lang.Object
io.leandev.appfuse.nls.Translation

public class Translation extends Object
A translation container that stores key-value pairs for internationalization. Keys are case-insensitive and automatically converted to lowercase.
  • Constructor Details

    • Translation

      public Translation()
  • Method Details

    • put

      public String put(String key, String value)
      Stores a translation with the given key and value. The key is automatically converted to lowercase. This method is annotated with @JsonAnySetter to allow Jackson to deserialize JSON properties into the translations map.
      Parameters:
      key - the translation key (will be converted to lowercase)
      value - the translation value
      Returns:
      the previous value associated with the key, or null if there was no mapping
    • get

      public String get(String key)
      Retrieves a translation for the given key. The key is automatically converted to lowercase.
      Parameters:
      key - the translation key (will be converted to lowercase)
      Returns:
      the translation value, or null if no translation exists
    • remove

      public String remove(String key)
      Removes the translation for the given key.
      Parameters:
      key - the translation key
      Returns:
      the previous value associated with the key, or null if there was no mapping
    • containsKey

      public boolean containsKey(String key)
      Returns true if this translation contains a mapping for the specified key.
      Parameters:
      key - the translation key
      Returns:
      true if a translation exists for the key
    • size

      public int size()
      Returns the number of translations.
      Returns:
      the number of key-value mappings
    • isEmpty

      public boolean isEmpty()
      Returns true if this translation contains no key-value mappings.
      Returns:
      true if this translation is empty
    • keySet

      public Set<String> keySet()
      Returns a set view of the keys contained in this translation.
      Returns:
      a set view of the keys
    • clear

      public void clear()
      Removes all translations.