IRdsAttributeTranslations.Item

Syntax

Item(Locale: LocaleCodeID): IRdsAttributeTranslation;

Parameters

Locale. Unique numeric language identifier.

Description

The Item property returns setting of attribute translation for the specified language.

Comments

It is prohibited to set the LocaleCodeID.None value as the Locale parameter.

If setting of translation for the language, specified in the Locale parameter, exists, the method returns this setting. If setting for the language, specified in the Locale parameter, does not exist, the method returns Null.

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;
        Attr: IRdsAttribute;
        Transl: IRdsAttributeTranslation;
    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 name of the dictionary 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 should be translated into different languages  
        AttrTransl.IsOn := True;
    // Set name of the NAME attribute for the Russian and English languages        
        Transl := AttrTransl.Item(LocaleCodeID.Russian);
        Transl.Name := State name;
        Transl := AttrTransl.Item(LocaleCodeID.English_UnitedStates);
        Transl.Name := "State name";
        Debug.WriteLine(Transl.Attribute.Name);
        Debug.WriteLine(Transl.Locale);
    // Save changes
        (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. Name of a dictionary and name of the NAME attribute are set to be displayed in these languages. Identifier of the additional attribute for translating values of the NAME attribute into the English language (USA) and unique identifier of this language are displayed in the console window.

See also:

IRdsAttributeTranslations