Add(Key: Integer): IResourceLocale;
Add(Key: uinteger): Prognoz.Platform.Interop.ForeIO.IResourceLocale;
Key. Language key.
The Add method adds a language with the specified key to the resource editor.
To specify language key, use values of the LocaleCodeID enumeration.
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.
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: