|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface LangPropertyArgument
Interface to be implemented to provide I18N of objects in language properties.
LangProperties properties = new LangProperties();
properties.put("en.i18n-object", "In English : {0} {1}");
properties.put("fr.i18n-object", "En Français : {0} {1}");
Object objectI18N = new LangPropertyArgument() {
public String getLangPropertyValue(String language) {
return language.equals("en") ? "Product" : "Produit";
}
};
Object objectNotI18N = new Object() {
@Override
public String toString() {
return String.valueOf(42);
}
};
// - objects which DO NOT implement the LangPropertyArgument uses toString method
// - objects which DO implement the LangPropertyArgument uses getLangPropertyName method
LangProperty property = new LangProperty("i18n-object", objectI18N, objectNotI18N);
assertEquals("In English : Product 42", properties.getExplicitLangProperty(property, "en"));
assertEquals("En Français : Produit 42", properties.getExplicitLangProperty(property, "fr"));
| Method Summary | |
|---|---|
String |
getLangPropertyValue(String language)
Retrieve the string value of this object in the specified language, when being used inside a language property. |
| Method Detail |
|---|
String getLangPropertyValue(String language)
language - the ISO-639 language code to be used to retrieve the localized Object's name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||