Displaying locale-specific information

You can display locale-specific information by adding a field to an entity definition and defining parent and child entities.

About this task

To display locale-specific information:

Procedure

  1. A field called LocaleDescriptionForEntity is added to entity definition, which is used to store localized description in each child table. Each child table is identified by this field.
  2. Set the value of this field to the name of the parent entity. This value should match the value of Name attribute in the parent entity.

    For example, if the entity definition to store localized values for a column in the parent table "PLT_QUALIFIED_TAG" is:

    
    <Entity Cacheable="true" 
       Description="Stores qualifier information" 
       EntityType="CONFIGURATION" AuditRequired="N" 
       Module="ycp" Name="QualifiedTag" Prefix="PLT_" 
       TableName="PLT_QUALIFIED_TAG" XMLName="QualifiedTag"> 
    <Attributes> 
    ....
    

    The corresponding child entity definition should be:

    
    <Entity Description="Stores qualifier information" 
       EntityType="CONFIGURATION" Name="Qualifier_Locale" 
       Prefix="YFS_" TableName="YFS_QUALIFIER_LOCALE" 
       XMLName="QualifierLocale" 
       LocaleDescriptionForEntity="QualifiedTag"> 
       ...
    

    You can define child tables for Platform or lower stack entities and mark columns as localized. Each entity can have only one localized child entity.

  3. Another field DisplayLocalizedFieldInLocale is added to the API layer. Pass this field to an API to indicate the locale from which the localized values must be displayed. The value of this field must be in the format, language_country_variant (fr_FR, en_US_CA):
    
    <?xml version="1.0" encoding="UTF-8"?> 
    <QualifiedTag QualifiedTagId="" QualifiedTagKey="key1" 
    DisplayLocalizedFieldInLocale=”fr_FR”/> 
    
  4. The get method for localized fields is modified to return the local values from the child tables, instead of the actual value. This method reads the locale set in the DisplayLocalizedFieldInLocale field and uses the language, country and variant information to obtain the corresponding values from the child table. For example, get QualifiedTagDescription()

    If there is no corresponding localized value, then the actual value from the parent entity is displayed.

  5. To obtain the actual value (non-localized values) from the parent entity instead of the localized one, use the method getNonLocalized. For example, getNonLocalized QualifiedTagDescription()