IResourceLocales.CurrentLocale

Syntax

CurrentLocale: IResourceLocale;

Description

The CurrentLocale property returns the current resource translation language.

Comments

The current translation language is a translation language edited in resources at the moment.

To get default resource language, use the IResourceLocales.DefaultLocale property.

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;
    Locale: IResourceLocale;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get resources
    Resource := mb.ItemById("APP_RESOURCE").Bind As IResourceObject;
    // Get resource languages collection
    Locales := Resource.Locales;
    // Get current resource translation language
    Locale := Locales.CurrentLocale;
    // Output language identifier to console window
    Debug.WriteLine("Current translation language: " + Locale.Id);
    // Output to console window whether 
    // current translation language is default resource language
    Debug.WriteLine("Default resource language: " + Locale.IsDefault.ToString);
End Sub UserProc;

After executing the example the console window displays identifier of the current translation language and indicator whether this language is a default resource language.

See also:

IResourceLocales