*** Welcome to piglix ***

Gettext

gettext
Original author(s) Sun Microsystems
Developer(s) various
Initial release 1990; 27 years ago (1990)
Repository various based on OpenSolaris and GNU gettext
Operating system Cross-platform
Type Internationalization and localization
License Various free software licenses
Website none

In computing, gettext is an internationalization and localization (i18n) system commonly used for writing multilingual programs on Unix-like computer operating systems. The most commonly used implementation of gettext is GNU gettext, released by the GNU Project in 1995.

gettext was originally written by Sun Microsystems in the early 1990s. The GNU Project released GNU gettext, a free software implementation of the system in 1995.

Source code is first modified to use the GNU gettext calls. For most programming languages, this is done by wrapping strings that the user will see in the gettext function. To save typing time, and to reduce code clutter, this function is commonly aliased to _, so that the C code:

would become:

Comments (starting with ///) placed directly before strings thus marked are made available as hints to translators by helper programs.

gettext then uses the supplied strings as keys for looking up alternative translations, and will return the original string when no translation is available. This is in contrast to POSIX catgets, AmigaOS GetString, or the use of LoadString under Microsoft Windows where a programmatic ID (often an integer) is used.

xgettext is run on the sources to produce a .pot (Portable Object Template) file, which contains a list of all the translatable strings extracted from the sources.

For example, an input file with a comment might look like:

xgettext is run using the command:

The resultant .pot file looks like this with the comment:


...
Wikipedia

...