Interface LangPropertyArgument

All Known Implementing Classes:
AbstractCalendarEvent, AbstractChooser, AbstractDBFaq, AbstractDBGlossary, AbstractDBTestType, AbstractEventResource, AbstractJPortal, AbstractMedia, AbstractPortalJspCollection, AbstractShortcut, AbstractTestType, AbstractWebPage, AccessControlList, AccessToken, ACLChooser, Alert, AuthenticationCookie, BackgroundProcessInfo, Category, CategoryRight, Content, CountryChooser, CountryData, CountryData, Data, DataRight, DBFileDocument, DBMember, FileDocument, FileProcessingInfo, FileProcessingLog, Form, Group, JPortalStructure, LanguageChooser, LanguageData, LoginEvent, MailMessage, MediaProgression, Member, MemberDeleteRequest, MemberPreference, Notification, NotificationCriteria, Portal, PortalElement, PortalRedirect, Portlet, PortletCollection, PortletParent, PortletSkinable, Publication, PublicationFollower, PublicDownload, PublicLink, ReaderTracker, Recommendation, StrongLock, TrackerInfo, TranstypedId, TranstypedType, UITheme, UIThemeSkin, UserContent, Vote, 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

    Modifier and Type
    Method
    Description
    Retrieve the string value of this object in the specified language, when being used inside a language property.
  • Method Details

    • 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