[Overview][Classes][Procedures and functions][Index] Reference for unit 'LCLTranslator' (#lcl)

Reference for unit 'LCLTranslator'

Performs string translation in the Lazarus IDE and LCL.

uses

  Classes,

  sysutils,

  TypInfo,

  gettext,

  LResources,

  

Maintains a global list of Lazarus resources, and provides methods and types used to stream components.

  Forms,

  

Implements Forms, which are the basis for the LCL Graphical User Interface.

  LCLType,

  

Provides compatibility with the Delphi Windows unit.

  Translations,

  LazFileUtils,

  LazUTF8;

Overview

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