FMX.Types.LoadLangFromStrings
Delphi
procedure LoadLangFromStrings(const AStr: TStrings);
C++
extern DELPHI_PACKAGE void __fastcall LoadLangFromStrings(System::Classes::TStrings* const AStr);
Contents
Properties
| Type | Visibility | Source | Unit | Parent | 
|---|---|---|---|---|
| procedure function | public | FMX.Types.pas FMX.Types.hpp | FMX.Types | FMX.Types | 
Description
Loads the language dictionary for translation from a specified TStrings.
AStr specifies the TStrings to load from. If AStr is empty, LoadLangFromStrings does not raise any errors and does not change the previous language dictionary. 
When a language dictionary is loaded, the translation is applied over all the strings that appear on the scene.
Switching the Language of Your Application at Run-time
There are special cases where switching between languages does not work as expected if the language that you switch to is English (en). As a workaround, we recommend that you use LoadLangFromStrings instead of setting TLang.Lang to switch between languages at run time.
The following code snippet shows how to use LoadLangFromStrings:
- Note: The code snippet below assumes that you added the desired languages in the Language Designer.
Delphi:
  //Lang1.Lang := 'en'; // do not use this 
  LoadLangFromStrings(Lang1.LangStr['en']); // use this instead
C++:
  //Lang1->Lang = "en"; // do not use this 
  LoadLangFromStrings(Lang1->LangStr["en"]); // use this instead