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 Summary
Constructors Constructor Description TranslationDataAdapter(PluginData pluginData, Class<?> viewInterface)TranslationDataAdapter(String pluginID, Class<?> viewInterface, Map<String,String> pluginData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetPluginID()Set<String>getTranslatableAttributes()Set<Locale>getUsedLocales()StringgetValue(String attrName, Locale locale)Returns the value of the specified attribute in the given locale.voidremoveTranslations(Locale locale)Removes all translations for the given locale.voidremoveValue(String attrName, Locale locale)voidsetValue(String attrName, String value, Locale locale)Sets the value of the specified attribute in the given locale to the given value.
-
-
-
Method Detail
-
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 attributelocale- the locale for which to get the translated value; usenullto 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 attributevalue- the new value of the specified attribute in the given localelocale- the locale for which to set the translated value; usenullto set the default value
-
removeValue
public void removeValue(String attrName, Locale locale)
- Parameters:
attrName- name of the desired attributelocale- the locale for which to remove the translated value; usenullto 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
-
-