IRdsAttributeTranslations.DefaultAttribute

Syntax

DefaultAttribute: IRdsAttribute;

Description

The property is read-only.

The DefaultAttribute property returns the main attribute, which values should be translated into different languages.

Comments

When a language setting is added (the IRdsDictionaryTranslations.Add method), additional attributes of the dictionary are created. They are created for all string attributes, which values should be translated (the IRdsAttributeTranslations.IsOn property), and they are copies of these attributes. An identifier of additional attributes consists of the main attribute identifier with a suffix, that is, international language abbreviation. For example, on adding settings of translation into the English language (USA), the additional attribute NAME_EN is created for the NAME attribute. The IRdsAttributeTranslations.IsTranslation property is set to True for all additional attributes of the translation.

This property returns the MDM dictionary attribute that corresponds to the main attribute for the settings of main attribute.

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 UserProc;
    Var
        Mb: IMetabase;
        RdsRepoDescr: IMetabaseObjectDescriptor;
        RdsDict: IRdsDictionary;
        DictTransl: IRdsDictionaryTranslations;
        AttrTransl: IRdsAttributeTranslations;
        DictAttrs: IRdsAttributes;
        i: Integer;
        Attr: IRdsAttribute;
        MainAttr: 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 should 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;
        DictAttrs := RdsDict.Attributes;
    // Display names of the x basis and additional attributes of translation
        For i := 0 To DictAttrs.Count - 1 Do
            Attr := DictAttrs.Item(i);
            AttrTransl := Attr.Translations;
            If AttrTransl.IsTranslation Then
                MainAttr := AttrTransl.DefaultAttribute;
                Debug.WriteLine(Main attribute:  + MainAttr.Name);
                Debug.WriteLine(Additional attribute of translation:  + Attr.Name);
            End If;
        End For;
        (RdsDict As IMetabaseObject).Save;
    End Sub UserProc

After executing the example the MDM dictionary is set up to work with the Russian and English languages. The names of main and additional translation attributes are displayed in the console window.

See also:

IRdsAttributeTranslations