IsCurrent: Boolean;
IsCurrent: boolean;
The IsCurrent property determines whether the language is the current translation language.
Available values:
True. The language is the current translation language.
False. The language is not the current translation language.
Translation language is a language that is used to display values in the repository language for the current user, if it differs from the default repository language. If resources do not contain the translation language that matches the current user repository language, default resource language values are used.
Executing the example requires that the repository contains resources with the APP_RESOURCE identifier. These resources must contain several languages.
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").Edit As IResourceObject;
// Get resource languages collection
Locales := Resource.Locales;
// Get the second resource language
Locale := Locales.Item(1);
// Check if the language is the current translation language
If Locale.IsCurrent
// If the language is, display appropriate message
Then
Debug.WriteLine(Locale.Id + "(" + Locale.Key.ToString + ")" +
"Current translation language");
// If the language is not, make it the current translation language
Else
Locale.IsCurrent := True;
End If;
// Save changes
(Resource As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the second resource language is set as a translation language.
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"].Edit() As IResourceObject;
// Get resource languages collection
Locales := Resource.Locales;
// Get second resource language
Locale := Locales.Item[1];
// Check if the language is the current translation language
If Locale.IsCurrent
// If the language is, display appropriate message
Then
System.Diagnostics.Debug.WriteLine(Locale.Id + "(" + Locale.Key.ToString() + ")" +
"Current translation language");
// If the language is not, make it the current translation language
Else
Locale.IsCurrent := True;
End If;
// Save changes
(Resource As IMetabaseObject).Save();
End Sub;
See also: