IResourceLocales.Add

Syntax

Add(Key: Integer): IResourceLocale;

Parameters

Key. Language key.

Description

The Add method adds a language with the specified key to the resource editor.

Comments

To specify language key, use values of the LocaleCodeID enumeration.

Example

Executing the example requires that the repository contains resources with the APP_RESOURCE identifier.

Add links to the IO, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Resource: IResourceObject;
    Locales: IResourceLocales;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get resources
    Resource := mb.ItemById("APP_RESOURCE").Edit As IResourceObject;
    // Get resource languages collection
    Locales := Resource.Locales;
    // Check if the collection contains French
    If Locales.FindByKey(LocaleCodeID.French_France) = Null Then
        // If French is missing, add it
        Locales.Add(LocaleCodeID.French_France)
    End If;
    // Save changes
    (Resource As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the French language is added into resource editor.

See also:

IResourceLocales