TLang = class(TFmxObject)
class PASCALIMPLEMENTATION TLang : public TFmxObject
Used for translating strings from the application.
Use TLang for defining lists of strings that can be translated in order to localize an application. Add a TLang component from the Tool Palette on your form and double-click it to open the Language Designer.
The Language Designer finds all the strings in the application and allows you to add a list of languages in which to translate them. The original strings are placed in the first column and you can insert the translations in the second column.
By clicking Save file... in the Language Designer, you can save all the TLang strings in a file. Also, the designer allows you to use an existing file, by clicking Load file....
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.
//Lang1.Lang := 'en'; // do not use this LoadLangFromStrings(Lang1.LangStr['en']); // use this instead
//Lang1->Lang = "en"; // do not use this LoadLangFromStrings(Lang1->LangStr["en"]); // use this instead