Contains classes and routines used to load/check/maintain translations from .po (portable object) files.
uses |
||
jsonscanner, |
||
jsonparser, |
||
|
Miscellaneous routines, types, and classes for manipulating files, file names, and paths. |
|
|
Contains types, procedures, and functions used for file and directory operations. |
|
|
Number of characters (codepoints) to get from the string. |
|
|
Contains routines used to perform conversions between Unicode and System Code Page encodings. |
|
|
Defines base logging classes used in the Lazarus IDE. |
|
|
An Average Level Tree structure, which is kept balanced so that finding a node is very rapid. |
|
|
Implements a hashed list of string values. |
translations.pas contains classes and routines used to load/check/maintain translations from .po (portable object) files.
translations.pas is part of the LazUtils package.
Initial authors: Mattias Gaertner, Bart Broersma, Giuliano Colla
Example 1: Load a specific .po file
procedure TForm1.FormCreate(Sender: Object var PODirectory: String; begin PODirectory := '/path/to/lazarus/lcl/languages/'; TranslateUnitResourceStrings('LCLStrConsts', PODirectory+'lcl.%s.po', 'nl', ''); MessageDlg('Title', 'Text', mtInformation, [mbOk, mbCancel, mbYes], 0); end;
Example 2: Load the current language file using the GetLanguageID function:
uses ... Translations; procedure TranslateLCL; var PODirectory: String; LangID: TLanguageID; begin PODirectory:='/path/to/lazarus/lcl/languages/'; LangID := GetLanguageID; Translations.TranslateUnitResourceStrings('LCLStrConsts', PODirectory+'lclstrconsts.%s.po', LangID.LanguageID, LangID.LanguageCode); end; ... begin TranslateLCL; Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end.
Lazarus Utilities (LazUtils) | Version 3.99-1d79f9e4df (2024-03-21) | Home |