IResourceStrings.Value

Syntax

Value[Id: String]: String;

Parameters

Id. String identifier.

Description

The Value property determines a string of resource editor, which identifier is passed by the Id parameter.

Comments

Identifier of a string is case-sensitive.

Example

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.

See also:

IResourceStrings