IResourceImporter.Locales

Syntax

Locales: Array;

Description

The Locales property determines the resources languages for the import.

Example

Executing the example requires that the repository contains resources with the RESOURCES identifier. There also should be a file, into which the C:\Res.txt resources were exported.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

ImpObj: ResourceImporter;

Prov: DtTextProvider;

ResObj: IResourceObject;

CountrysArr: Array[0..1] Of String;

Log: IResourceImporterLog;

i: Integer;

s: String;

Begin

Prov := New DtTextProvider.Create;

ImpObj := New ResourceImporter.Create;

MB := MetabaseClass.Active;

MObj := MB.ItemById("RESOURCES").Edit;

ResObj := MObj As IResourceObject;

Prov.File := "C:\Res.txt";

Prov.RangeHasHeader := True;

ImpObj.Provider := Prov;

CountrysArr[0] := "ru";

CountrysArr[1] := "en";

ImpObj.Locales := CountrysArr;

ImpObj.Resource := ResObj;

ImpObj.Method := ResourceImportType.UpdateAndAdd;

ImpObj.Import;

Log := ImpObj.Log;

Debug.WriteLine("Altogether " + Log.Count.ToString + " records");

For i := 0 To Log.Count - 1 Do

Select Case log.State(i).ToString

Case "0": s := " - record added";

Case "1": s := " - record updated";

Case "2": s := " - record passed";

End Select;

Debug.WriteLine(Log.Item(i) + s);

End For;

End Sub Main;

After executing the example resources are imported from the C:\Res.txt file. The elements missing in the current resources are imported, and existing elements values are updated. Information about import process is displayed in the console window.

See also:

IResourceImporter