gettext

gettext provides an option to use different strings for any number of plural forms of nouns, but this feature has no support for grammatical gender.

[1] The Unix and POSIX developers never really agreed on what kind of interface to use (the other option is the X/Open catgets), so many C libraries, including glibc, implemented both.

[7] As of August 2019[update], whether gettext should be part of POSIX was still a point of debate in the Austin Group, despite the fact that its old foe has already fallen out of use.

Concerns cited included its dependence on the system-set locale (a global variable subject to multithreading problems) and its support for newer C-language extensions involving wide strings.

This is in contrast to POSIX catgets(),[14] AmigaOS GetString(),[15] or Microsoft Windows LoadString() where a programmatic ID (often an integer) is used.

To handle the case where the same original-language text can have different meanings, gettext has functions like cgettext() that accept an additional "context" string.

The user, on Unix-type systems, sets the environment variable LC_MESSAGES, and the program will display strings in the selected language, if there is an .mo file for it.

Its main difference from the Unix variable is that it supports multiple languages, separated with a colon, for fallback.

Consider the code sample: A header in the "" (empty string) entry of the PO file stores some metadata, one of which is the plural form that the language uses, usually specified using a C-style ternary operator.

Typical gettext workflow. The de.po instance on the left shows a "renewing" of translations via msgmerge.