GnuGetText tools for Delphi |
|
The program ggdxgettext.exe scans the source texts (dpr, dfm and pas files) of a Delphi project for strings to be translated and creates a po template from them.
After starting the program, the window shown on the right opens, in which at the uppermost place the project directory (base directory) is to be named. It can either be specified in the command line when the program is called (see below) or selected in a dialog by clicking on the icon on the right. Further options:
Clicking the OK button will start the scanning of the selected source files.
In the dialog window (see fig. at right) the progress of the scanning for strings
to be translated is displayed. Special attention should be paid to whether errors
are displayed, e.g. if non-ASCII encodable characters are used in the source texts.
In this case you must either change these characters or select another text encoding
(see above).
The output of the template is always in UTF-8 format.
Calling: | ggdxgettext.exe <name> [options] | |
<name> | Name of the base directory or file, to be scanned | |
/dom:<domain> | Use another text domain (instead of default) |
Example:
ggdxgettext.exe "E:\Projects\Translate\sample\" /dom:sample.
Using the program ggmerge.exe will insert all new and changed strings in an updated template into the po file with the translation. This should then further be edited with an editor (e.g. PoEdit).
After starting the program, the window shown on the right opens, in which the po file to be updated must be specified in the uppermost position. It can either be specified in the command line when the program is started (see below) or selected in a dialog by clicking on the icon on the right. After that, select the po template to be used for the adjustment. Further options:
Calling: | ggmerge.exe <poname> [options] | |
<poname> | Name of the translated po to be updated | |
/noedit | Do not start the associated editor. |
Example:
ggmerge.exe "E:\Projects\Translate\sample\languages\de\default.po".
ggfmt.exe is a console program that can convert po files (text) to binary mo files and reverse.
Calling: | ggfmt.exe <filename> [options] | |
<filename> | Name of file to be converted Default: Create a binary list (mo file) from the translated strings. |
|
/u | convert a binary list to a po file (text) Default extension for output file: .po |
|
/e:<ext> | Use a different extension than default. |
The program ggassemble.exe will allow you to embed one or also several translations into an Exe file. Thus it is no longer necessary for the distribution of the Delphi program to attach the subdirectories locale\<Lang-Id>\LC_MESSAGES\, since the translations are integrated into the Exe file.
The program requires the specification of the exe file to be processed. This is normally specified in the command line (see below). If this specification is missing, the user is prompted to select the desired exe file. After starting, the program searches for mo files in the subdirectories of the type mentioned above in the directory of the exe file and displays them in a list. The user selects the languages and text domains to be embedded and clicks Start. Prerequisite for this function to work is that the GnuGetText.pas unit is included in the source code of the program and the exe file is freshly compiled, i.e. no translations have been embedded yet. A successful action is indicated by a corresponding message (see figure below right).
Calling: | ggassemble.exe <filename> [options] | |
<filename> | Name of the exe file in which the mo files are to be embedded. | |
/lang:<list> | List of languages that are to be embedded <list> is a comma separated list of the language codes according to ISO 639. Example: /lang:de,fr,es |
|
/dom:<list> | List of additional domains to be embedded (other than default) <list> is a comma separated list of the domain names. Example: /dom:delphi10,dialogs,units |
|
/force | Do not show the interactive window, start embedding immediately (e.g. for batch processing). |
When installing the program package, the necessary registry entries are automatically made to adjust the Windows context menus:
1. Right-click on a directory, e.g. sample | 2. Right-click on a source file, e.g. GgtUtils.pas | |
scans all program sources in the selected directory to create the translation template (po file). | scans the selected source file to create the translation template (po file). | |
3. Right-click on a po file, e.g. default.po | 4. Right-click on an exe file, e.g. GgtTranslate.exe | |
merges the translation with the updated template and starts an editor (e.g. PoEdit) for post-processing. | embeds the translations into the selected exe file. |