procedure UseLanguage(LanguageCode: string);

When an application starts up, the initialization section of gnugettext.pas makes this call:

UseLanguage('');

This call examines the system language settings and sets the language values accordingly. On Windows, GetLocaleInfo() is used to determine the language settings, although on Windows 95, GetThreadLocale() is used because GetLocaleInfo() wasn't implemented in that version.

The OS language settings can always be overridden by setting the LANG environment variable like this (example is for Windows):

set LANG=de_DE
myapp

or on Linux:

LANG=de_DE && ./myapp

When a language has been set, UseLanguage will examine the first two letters and find out which plural forms that apply to this language. See the Section called Plural forms in the chapter called Action> for more information on this topic.

All mo files that were open are closed. mo files are opened again when the text domains are accessed.

A language code usually consists of a two-letter lowercase language code, an underscore, and a two-letter uppercase country code. On Windows, this is not case sensitive, but on Linux, it is. German in Germany becomes de_DE, English in England becomes en_GB and flamish becomes nl_BE. If no translations can be found or a 5-character language code, the system automatically attempts to use only the first two digits. This means that if there is no nl_BE/default.mo file, nl/default.mo will be used instead, if present.

You can find the two-letter ISO 639 language codes in the Section called ISO 639 language codes in the appendix called Standards> and the two-letter ISO 3166 country codes in the Section called ISO 3166 country codes in the appendix called Standards>.