Sign in Join
FPDoc Onlineexperiment

LCLTranslator unit

Performs string translation in the Lazarus IDE and LCL.

lcltranslator.pas contains classes and routines used to perform translation for strings used in Lazarus IDE and LCL (Lazarus Component Library). It searches for .po (Portable Object) and/or .mo (Machine Object) files used to perform I18n internationalization and L10n localization. The .po/.mo files are stored in the languages or locale directories. To access translation files from an alternate location, use the LResources unit and the LRSMoFile variable directly.

To enable string translation, use this unit in your application and check the Enable i18n option in the Project > Project Options > i18n screen. You will need to call the SetDefaultLang routine in your code to activate the translation facility. If you want translation to be performed automatically, use the DefaultTranslator unit instead.

This unit also translates LCL string constants in the lclstrconsts file using files in the directory where program translation files are stored.

For more information, see the Lazarus Wiki article:

Creating Multi-Language Applications

lcltranslator.pas is part of the Lazarus Component Library ( LCL).

Classes and records

TDefaultTranslatorclassPerforms string translations using a .mo file (Machine Object).
TPOTranslatorclassPerforms string translations using a .po (Portable Object) file.
TUpdateTranslatorclassPerforms string translations for persistent objects.

Procedures and functions

SetDefaultLangfunctionSets the default language used for string translations.
TranslateLCLResourceStringsfunctionTranslates resource strings in LCLStrConsts.pas using localization files for the specified language.
TranslateUnitResourceStringsExfunctionTranslates string constants in a unit using the localization file for the specified language and path.

Uses

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.