gettext

Name

gettext -- retrieve text string from message catalog

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 variable. 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 the printf utility.

When used with the -s option the gettext utility behaves like the echo utility, except that the message corresponding to msgid in the selected catalog provides the arguments.

Options

-d domainname, --domain=domainname 

PARAMETER 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.

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 catalog, and if present replaces the implementation-defined default directory.

Exit Status

The following exit values are returned:

0 

Successful completion.

>0 

An error occurred.