[Overview][Classes][Procedures and functions][Index] |
Sets the default language used for string translations.
Source position: lcltranslator.pas line 82
function SetDefaultLang( |
Lang: string; |
Dir: string = ''; |
LocaleFileName: string = ''; |
ForceUpdate: Boolean = True |
):string; |
Lang |
|
Language ID to use for translated strings. |
Dir |
|
Directory name with translation files. |
LocaleFileName |
|
Locale code for the localization file. |
ForceUpdate |
|
Indicates if the UI should be updated immediately. |
Default language code in use.
SetDefaultLang is a procedure used to the set the default language used for string translations.
Lang contains the Language ID to use for translated strings. Lang contains a language identifier defined in ISO 639, at: ISO 639 - Codes for the Representation of Names of Languages
The default value for the parameter is an empty string (''), and indicates that strings are not translated.
Dir contains the directory name where .po/.mo files are stored. The default value is an empty string (''), and indicates that the default directories are used for translation files.
LocaleFileName contain the localization file used for for strings. This file handles variations in grammar and spelling that occur in local dialects for a language. It contains a value like 'zh_cn' or 'pt_br'. The default value is an empty string (''), and indicates that localization is not preformed for resource strings.
ForceUpdate indicates if an immediate update to to the User Interface is performed when translations are loaded. Set ForceUpdate to False when SetDefaultLang is called from the initialization section for a unit. The default value is True.
SetDefaultLang ensures that Language ID and Locale Codes are valid, and .po/.mo exist for the specified names before they are applied. SetDefaultLang calls the FindLocaleFileName function to get the file name used for translation resources. .po files are applied when they exist. Otherwise, .mo file are used to get the translated string values. LCL resource string constants are also translated when the default language code is assigned.
When ForceUpdate contains True, string properties used in Forms, Data Modules, Controls, Components and Persistent objects are translated. This action is performed for items with RTTI (Run Time Type Information) and includes a setter (write access) procedure. TUpdateTranslator is used to perform the update to user interface elements.
|
Performs string translations using a .po (Portable Object) file. |
|
|
Performs string translations using a .mo file (Machine Object). |
|
|
Performs string translations for persistent objects. |
|
|
Deprecated. |
lazarus-ccr.sourceforge.net |