GNU gettext for Delphi, C++ Builder and Kylix 1.2 beta
<<< Previous | Introduction | Next >>>

# Creating po files

Instead of typing the whole po file yourself, you can create it by scanning the source code. There are several ways of doing that:

- There is a command line tool named `dxgettext` that can scan Delphi pas, dfm, xfm, rc files

- The `dxgettext` commandline tool is also able to extract all the resourcestrings from an executable file on Windows - like .exe files, .dll files etc.

- The `xgettext` commandline tool can scan C and C++ files.

- On Windows, you can right-click a file folder in Windows Explorer and choose "Extract strings" in the popup menu. From the window that then pops up, you can scan all types of files that can be scanned with the command line tools mentioned above.

These scanners are very advanced. They don't pick up every string they find in a .pas file - only the strings that are surrounded by calls to gettext() and similar functions. This means that in this example, the string will not be extracted:

     a:='Hello, World';
     a:=gettext(a);

Actually, the system will give a warning that `a` is unknown. But in this example, it will get extracted:

     a:=gettext('Hello, World');

This means that each single string has to be put in between the ( ) of the function call. In order to save you some typing, an alias for gettext() has been made, and is named _(). The above example can there also be written this way:

     a:=_('Hello, World');

In order to have access to this function, you must include gnugettext.pas in your Delphi or C++ Builder project. This file is part of the installation.

<<< Previous | Home | Next >>>
Introduction | Up | More gettext functions