ValueTranslation(Index: Integer; Locale:LocaleCodeID): Variant;
Index. Attribute index.
Locale. Unique numeric language identifier.
The ValueTranslation property determines attribute value by its index 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).
A value of the Index parameter must be a non-negative number but smaller than the value of the IRdsDictionaryElementData.Count property. Index of the first attribute in a collection - 0, the last one - IRdsDictionaryElementData.Count - 1. Index numbering is continuous.
It is prohibited to set the LocaleCodeID.None value 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;
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;
ElemData.ValueTranslation(1, LocaleCodeID.Russian) := Russia;
ElemData.ValueTranslation(1, 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: