IRdsDictionary.Translations

Syntax

Translations: IRdsDictionaryTranslations;

Description

The Translations property returns a collection of settings that contain translation parameters of the MDM dictionary into different languages.

Comments

Initially, the collection contains a setting for the language set for repository user by default. Translation into other languages must be enabled for the MDM dictionary so that settings from the collection were available for the MDM dictionary, that is, the IRdsDictionaryTranslations.IsOn property must be set to True.

Example

Executing the example requires an MDM repository that contains the MDM dictionary. The repository identifier is RDS_REPO, the dictionary identifier is RDS_DICT. For user repository the Russian language is default language. It is also necessary to add links to the Metabase and Rds system assemblies.

Sub UserSub;
Var
    Mb: IMetabase;
    RdsRepoDescr: IMetabaseObjectDescriptor;
    RdsDict: IRdsDictionary;
    DictTransl: IRdsDictionaryTranslations;
    AttrTransl: IRdsAttributeTranslations;
    Attr: IRdsAttribute;
Begin
    Mb := MetabaseClass.Active;
    RdsRepoDescr := Mb.ItemById("RDS_REPO");
    RdsDict := Mb.ItemByIdNamespace("RDS_DICT", RdsRepoDescr.Key).Edit As IRdsDictionary;
   DictTransl := RdsDict.Translations;
    // Specify that dictionary will be translated into different languages   
    DictTransl.IsOn := True;
    // Check whether a setting with parameters of translation into English exists
    If DictTransl.FindByLocale(LocaleCodeID.English_UnitedStates) = Null Then
    // Setting is missing, add it
        DictTransl.Add(LocaleCodeID.English_UnitedStates);
    End If;
    // Set dictionary name for the Russian and English languages
    DictTransl.Name(LocaleCodeID.Russian) := States dictionary;
    DictTransl.Name(LocaleCodeID.English_UnitedStates) := "States dictionary";
    //  Receive parameters of the NAME attribute
    Attr := RdsDict.Attributes.FindById("NAME");
    AttrTransl := Attr.Translations;
    // Specify that attribute will be translated into different languages  
   AttrTransl.IsOn := True;
    // Set name of the NAME attribute for the Russian and English languages        
    AttrTransl.Name(LocaleCodeID.Russian) := State name;
    AttrTransl.Name(LocaleCodeID.English_UnitedStates) := "State name";
    // Save changes  
    (RdsDict As IMetabaseObject).Save;
End Sub UserSub;

After executing the example the MDM dictionary is set up to work with the Russian and English languages. Name of a dictionary and name of the NAME attribute are set to be displayed in these languages.

See also:

IRdsDictionary