IResourceLocales.Add

Fore Syntax

Add(Key: Integer): IResourceLocale;

Fore.NET Syntax

Add(Key: uinteger): Prognoz.Platform.Interop.ForeIO.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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.ForeIO;
Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Resource: IResourceObject;
    Locales: IResourceLocales;
Begin
    // Get current repository
    mb := Params.Metabase;
    // 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.lcidFrench_France) = Null Then
        // If French is missing, add it
        Locales.Add(LocaleCodeID.lcidFrench_France)
    End If;
    // Save changes
    (Resource As IMetabaseObject).Save();
End Sub;

See also:

IResourceLocales