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 String
getPluginID()
Set<String>
getTranslatableAttributes()
Set<Locale>
getUsedLocales()
String
getValue(String attrName, Locale locale)
Returns the value of the specified attribute in the given locale.void
removeTranslations(Locale locale)
Removes all translations for the given locale.void
removeValue(String attrName, Locale locale)
void
setValue(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; usenull
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 attributevalue
- the new value of the specified attribute in the given localelocale
- the locale for which to set the translated value; usenull
to 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; usenull
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
-
-