IResourceLocales.CurrentLocale

Fore Syntax

CurrentLocale: IResourceLocale;

Fore.NET Syntax

CurrentLocale: Prognoz.Platform.Interop.ForeIO.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.

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

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;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Resource: IResourceObject;
    Locales: IResourceLocales;
    Locale: IResourceLocale;
Begin
    // Get current repository
    mb := Params.Metabase;
    // 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
    System.Diagnostics.Debug.WriteLine("Current translation language: " + Locale.Id);
    // Output to console window whether 
    // current translation language is default resource language
    System.Diagnostics.Debug.WriteLine("Default resource language: " + Locale.IsDefault.ToString());
End Sub;

See also:

IResourceLocales