Class TranslationDataAdapter

java.lang.Object
de.aristaflow.adept2.model.common.i18n.TranslationDataAdapter

public class TranslationDataAdapter extends Object
Facilitates the getting of setting of translatable attributes and their translations.
Author:
Patrick Schmidt
  • Constructor Details

    • TranslationDataAdapter

      public TranslationDataAdapter(PluginData pluginData, Class<?> viewInterface)
    • TranslationDataAdapter

      public TranslationDataAdapter(String pluginID, Class<?> viewInterface, Map<String,String> pluginData)
  • Method Details

    • getTranslatableAttributes

      public Set<String> getTranslatableAttributes()
    • getPluginID

      public String getPluginID()
    • getValue

      public String getValue(String attrName, Locale locale)
      Returns the value of the specified attribute in the given locale.
      Parameters:
      attrName - name of the desired attribute
      locale - the locale for which to get the translated value; use null to get the default value
      Returns:
      the value of the specified attribute in the given locale; could be null
    • setValue

      public void setValue(String attrName, String value, Locale locale)
      Sets the value of the specified attribute in the given locale to the given value.
      Parameters:
      attrName - name of the desired attribute
      value - the new value of the specified attribute in the given locale
      locale - the locale for which to set the translated value; use null to set the default value
    • removeValue

      public void removeValue(String attrName, Locale locale)
      Parameters:
      attrName - name of the desired attribute
      locale - the locale for which to remove the translated value; use null to remove the default value
    • removeTranslations

      public void removeTranslations(Locale locale)
      Removes all translations for the given locale.
      Parameters:
      locale - the locale for which to remove all translations
    • getUsedLocales

      public Set<Locale> getUsedLocales()