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

# More gettext functions

Since you can have several mo files, there must be ways to choose between them. The default setting is to use the "default" domain, which means the file default.mo, if present. You can change the default text domain using the `textdomain()` procedure. You can also ask for a single translation from another textdomain like this:

     a:=dgettext('languagenames','Danish');

Here, the string "Danish" will be looked up in languagenames.mo, and if it exists, the translation will be assigned to `a`. If no translation exists, or if the languagenames.mo file doesn't exist for the current language, the string "Danish" will be assigned to `a`.

If you want to use a special language, you can switch the default language using the UseLanguage() procedure, which takes the two-letter language code as parameter:

    UseLanguage ('da'); // selects Danish

You can also specify a language and a country using the two-letter language and the two letter country code like this:

    UseLanguage ('en_US');  // selects American English

The default is to use the language setting in Windows or Linux.

<<< Previous | Home | Next >>>
Creating po files | Up | Resourcestrings