IRdsAttributeTranslations.IsTranslation

Syntax

IsTranslation: Boolean;

Description

The property is read-only.

The IsTranslation property returns whether the given attribute is an additional one used for translation.

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 IsTranslation property is set to True for all additional attributes of translation.

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;
        TranslAttr: 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 main and additional attributes of translation
        For i := 0 To DictAttrs.Count - 1 Do
            Attr := DictAttrs.Item(i);
            AttrTransl := Attr.Translations;
            If (AttrTransl.IsOn) And Not (AttrTransl.IsTranslation) Then
                Debug.WriteLine(Main attribute:  + Attr.Name);
                TranslAttr := AttrTransl.Attribute(LocaleCodeID.English_UnitedStates);
                Debug.WriteLine(Additional attribute of translation:  + TranslAttr.Name);
                Debug.WriteLine(Unique identifier of the main language:  + AttrTransl.TranslationLocale.ToString);
            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. Names of main and additional translation attributes and unique identifier of the main language are displayed in the console window.

See also:

IRdsAttributeTranslations