AttributeTranslation(AttributeKey: Integer; Locale:LocaleCodeID): Variant;
AttributeKey. Attribute key.
Locale. Unique numeric language identifier.
The AttributeTranslation property determines attribute value by its key for the specified language.
Value can be set only for a string attribute, if translation into different languages is allowed for the attribute and the MDM dictionary (the IRdsAttributeTranslations.IsOn and IRdsDictionaryTranslations.IsOn properties).
It is prohibited to set value LocaleCodeID.None as the Locale parameter.
Executing the example requires an MDM repository that contains the MDM dictionary. The repository identifier is RDS_REPO, the dictionary identifier is RDS_DICT. It is also necessary to add links to the Metabase and Rds system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RdsRepoDescr: IMetabaseObjectDescriptor;
RdsDictObj: IMetabaseObject;
RdsDict: IRdsDictionary;
DictTransl: IRdsDictionaryTranslations;
RdsDictInst: IRdsDictionaryInstance;
ElemData: IRdsDictionaryElementData;
Attr: IRdsAttribute;
Begin
Mb := MetabaseClass.Active;
RdsRepoDescr := Mb.ItemById("RDS_REPO");
RdsDictObj := Mb.ItemByIdNamespace("RDS_DICT", RdsRepoDescr.Key).Edit;
RdsDict := RdsDictObj As IRdsDictionary;
DictTransl := RdsDict.Translations;
DictTransl.Add(LocaleCodeID.English_UnitedStates);
RdsDictInst := RdsDictObj.Open(Null) As IRdsDictionaryInstance;
ElemData := RdsDictInst.CreateElementData;
Attr := RdsDict.Attributes.Name;
ElemData.AttributeTranslation(Attr.Key, LocaleCodeID.Russian) := Russia;
ElemData.AttributeTranslation(Attr.Key, LocaleCodeID.English_UnitedStates) := "Russia";
RdsDictInst.Insert(-2, ElemData);
RdsDictObj.Save;
End Sub UserProc;
After executing the example the MDM dictionary is set up to work with the Russian and English languages. A new element, for which a value of the NAME attribute is set for the Russian and English languages, is added into a dictionary.
See also: