Unit CastleLocalizationGetText
Description
Utilities for localizing CGE applications using GetText.
Uses
- SysUtils
- Classes
- GetText
- CastleClassUtils
- CastleUnicode
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
Class ETranslationEmptyId |
|
Class TCastleMOFile |
TMOFile descendant that allows iterating through all strings. |
Functions and Procedures
function GetTextPoEntry(const Context, Id, EnglishText: String; const MsgidFromId: Boolean = true): String; |
function GenerateGetTextPo(const C: TComponent; const GroupName: String): String; |
function GenerateGetTextPo(const UrlMask: String): String; |
function LoadGetTextMo(const Url: String): TCastleMOFile; deprecated 'use TCastleMOFile.Create'; |
procedure AddTranslatedCharacters(const Url: String; const Characters: TUnicodeCharList); |
procedure AddTranslatedCharacters(const Mo: TCastleMOFile; const Characters: TUnicodeCharList); |
procedure TranslateAllDesigns(const GetTextMoUrl: String); |
procedure TranslateDesign(const C: TComponent; const GroupName: String; const GetTextMo: TCastleMOFile); |
procedure CastleTranslateResourceStrings(const GetTextMoUrl: String); |
Description
Functions and Procedures
function GetTextPoEntry(const Context, Id, EnglishText: String; const MsgidFromId: Boolean = true): String; |
Generate text to insert to POT (PO template) to allow translating given text. Depending on MsgidFromId:
|
function GenerateGetTextPo(const C: TComponent; const GroupName: String): String; |
Generate GetText PO file contents that can be used as a basis for translators to localize this component. The component may be a hierarchy of user interface and transformations, just like for CastleComponentSerialize. A typical workflow of translation is:
The argument of this routine can be a TComponent hierarchy, which can be a TCastleUserInterface or TCastleTransform hierarchy designed in the CGE editor or in code. The argument can also be an URL of a design (loaded using CastleSerializeComponent) or a mask (using wildcards * and ?) to load multiple designs. The design basename (part of URL without extension and path) is the prefix for all identifiers inside. The file will include all translatable properties in the given component hierarchy, with their current values (by convention in English). By convention you store this file as "xxx.pot" or ""xxx.en.po" and then translate it e.g. to "xxz.ja.po" which you can use to load Japanese translations by TranslateDesigns . |
function GenerateGetTextPo(const UrlMask: String): String; |
This item has no description. |
function LoadGetTextMo(const Url: String): TCastleMOFile; deprecated 'use TCastleMOFile.Create'; |
Warning: this symbol is deprecated: use TCastleMOFile.Create Load GetText MO file from and URL. |
procedure AddTranslatedCharacters(const Url: String; const Characters: TUnicodeCharList); |
Extract from MO file all unique characters in translated strings, add them to Characters. |
procedure AddTranslatedCharacters(const Mo: TCastleMOFile; const Characters: TUnicodeCharList); |
This item has no description. |
procedure TranslateAllDesigns(const GetTextMoUrl: String); |
Translate all future designs (component hierarchies) loaded using CastleComponentSerialize using the given GetText MO file. This is the simplest way to translate user interface designed using CGE Editor. The GetText PO file with suitable identifiers should be earlier generated using GenerateGetTextPo, translated, and processed to MO format using GetText tools. Calling this routine again will override the effect of the previous call. That is, at a given time, only one MO file is "active" and automatically translates all the loaded designs. Pass GetTextMoUrl = '' to disable translating further UIs. See also
|
procedure TranslateDesign(const C: TComponent; const GroupName: String; const GetTextMo: TCastleMOFile); |
Translate all possible properties in the given component hierarchy with given translation file. Missing translations will cause a warning in the log (indicating that your translation file is outdated and doesn't reflect all UI stuff anymore). If all your designs are loaded from files (using CastleComponentSerialize) then usually it's more comfortable to use TranslateAllDesigns instead of this routine. This routine is however more flexible, and allows to translate any component hierarchy. See also
|
procedure CastleTranslateResourceStrings(const GetTextMoUrl: String); |
Use this instead of FPC TranslateResourceStrings. This supports URL to MO file, and works cross-platform. |
Generated by PasDoc 0.16.0-snapshot.