gettext

Name

gettext -- retrieve text string from message database

Synopsis

gettext [ options ] [ textdomain ] msgid

gettext -s [ options ] msgid ...

Description

The gettext utility retrieves a translated text string corresponding to string msgid from a message object generated with msgfmt utility.

The message object name is derived from the optional argument textdomain if present, otherwise from the TEXTDOMAIN environment. If no domain is specified, or if a corresponding string cannot be found, gettext prints msgid.

Ordinarily gettext looks for its message object in dirname/lang/LC_MESSAGES where dirname is the implementation-defined default directory and lang is the locale name. If present, the TEXTDOMAINDIR environment variable replaces the dirname.

This utility interprets C escape sequences such as \t for tab. Use \\ to print a backslash. To produce a message on a line of its own, either put a \n at the end of msgid, or use this command in conjunction with printf utility.

When used with the -s option the utility behaves like the echo utility. But it does not simply copy its arguments to standard output. Instead those messages found in the selected catalog are translated.

Options

-d domainname, --domain=domainname

Retrieve translated messages from domainname.

-e

Enable expansion of some escape sequences.

-n

Suppress trailing newline.

Operands

The following operands are supported:

textdomain

A domain name used to retrieve the messages.

msgid

A key to retrieve the localized message.

Environment Variables

LANGUAGE

Specifies one or more locale names. See gettext message handling functions for more information.

LANG

Specifies locale name.

LC_MESSAGES

Specifies messaging locale, and if present overrides LANG for messages.

TEXTDOMAIN

Specifies the text domain name, which is identical to the message object filename without .mo suffix.

TEXTDOMAINDIR

Specifies the pathname to the message database, and if present replaces the implementation-defined default directory.

Exit Status

The following exit values are returned:

0

Successful completion.

>0

An error occurred.