Value[Id: String]: String;
Value[Id: string]: string;
Id. String identifier.
The Value property determines a string of resource editor, which identifier is passed by the Id parameter.
Identifier of a string is case-sensitive.
Executing the example requires that the repository contains resources with the APP_RESOURCE identifier that include a string element with the Button1 identifier. These resources contain default language as Russian and translation language as English.
Add links to the IO, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Resource: IResourceObject;
ResStrs: IResourceStrings;
Locales: IResourceLocales;
Locale: IResourceLocale;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get resources
Resource := mb.ItemById("APP_RESOURCE").Edit As IResourceObject;
// Get resource languages collection
Locales := Resource.Locales;
// Get default language
Locale := Locales.DefaultLocale;
// Get string elements for default language
ResStrs := Locale.Strings;
// Set string element value for default language
ResStrs.Value("Button1") := "Cancel";
// Get translation language
Locale := Locales.CurrentLocale;
// Get string elements for translation language
ResStrs := Locale.Strings;
// Set string element value for translation language
ResStrs.Value("Button1") := "Cancel";
// Save changes
(Resource As IMetabaseObject).Save;
End Sub UserProc;
After executing the example default language value and translation language value are set for the Button1 string element.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.ForeIO;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Resource: IResourceObject;
ResStrs: IResourceStrings;
Locales: IResourceLocales;
Locale: IResourceLocale;
Begin
// Get current repository
mb := Params.Metabase;
// Get resources
Resource := mb.ItemById["APP_RESOURCE"].Edit() As IResourceObject;
// Get resource languages collection
Locales := Resource.Locales;
// Get default language
Locale := Locales.DefaultLocale;
// Get string elements for default language
ResStrs := Locale.Strings;
// Set string element value for default language
ResStrs.Value["Button1"] := "Cancel";
// Get translation language
Locale := Locales.CurrentLocale;
// Get string elements for translation language
ResStrs := Locale.Strings;
// Set string element value for translation language
ResStrs.Value["Button1"] := "Cancel";
// Save changes
(Resource As IMetabaseObject).Save();
End Sub;
See also: