public interface LangPropertyArgument
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"));
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getLangPropertyValue(java.lang.String language)
Retrieve the string value of this object in the specified language,
when being used inside a language property.
|
java.lang.String getLangPropertyValue(java.lang.String language)
language
- the ISO-639 language code to be used to retrieve the localized Object's nameCopyright © 2001-2010 Jalios SA. All Rights Reserved.