com.jalios.util
Interface LangPropertyArgument

All Known Implementing Classes:
AbstractCalendarEvent, AbstractEventResource, AbstractReview, AbstractTestType, AccessControlList, Category, CategoryRight, Content, Data, DataExtension, DataRight, DBFileDocument, DBMember, FileDocument, FileProcessingInfo, FileProcessingLog, Form, Group, MailMessage, Member, Notification, NotificationCriteria, Portal, PortalElement, PortalRedirect, Portlet, PortletCollection, PortletParent, PortletSkinable, Publication, PublicationFollower, ReaderTracker, StrongLock, UserContent, WFNote, WKRole, Workspace, WSTypeEntry

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

getLangPropertyValue

String getLangPropertyValue(String language)
Retrieve the string value of this object in the specified language, when being used inside a language property.

Parameters:
language - the ISO-639 language code to be used to retrieve the localized Object's name
Returns:
this object as a string value in the specified language


Copyright © 2001-2010 Jalios SA. All Rights Reserved.