manpagez: man pages & more
info gettext
Home | html | info | man

File: gettext.info,  Node: gettext Invocation,  Next: ngettext Invocation,  Prev: Preparing for printf_gettext,  Up: sh

16.5.15.8 Invoking the ‘gettext’ program
........................................

     gettext [OPTION] [[TEXTDOMAIN] MSGID]
     gettext [OPTION] -s [MSGID]...

   The ‘gettext’ program displays the native language translation of a
textual message.

*Options and arguments*

‘-c CONTEXT’
‘--context=CONTEXT’
     Specify the context for the messages to be translated.  See *note
     Contexts:: for details.

‘-d TEXTDOMAIN’
‘--domain=TEXTDOMAIN’
     Retrieve translated messages from TEXTDOMAIN.  Usually a TEXTDOMAIN
     corresponds to a package, a program, or a module of a program.

‘-e’
     Enable expansion of some escape sequences.  This option is for
     compatibility with the ‘echo’ program or shell built-in.  The
     escape sequences ‘\a’, ‘\b’, ‘\c’, ‘\f’, ‘\n’, ‘\r’, ‘\t’, ‘\v’,
     ‘\\’, and ‘\’ followed by one to three octal digits, are
     interpreted like the System V ‘echo’ program did.

‘-E’
     This option is only for compatibility with the ‘echo’ program or
     shell built-in.  It has no effect.

‘-n’
     This option has only an effect if the ‘-s’ option is given.  It
     suppresses the additional newline at the end.

‘[TEXTDOMAIN] MSGID’
     Retrieve translated message corresponding to MSGID from TEXTDOMAIN.

*Informative output*

‘-h’
‘--help’
     Display this help and exit.

‘-V’
‘--version’
     Output version information and exit.

   If the TEXTDOMAIN parameter is not given, the domain is determined
from the environment variable ‘TEXTDOMAIN’.  If the message catalog is
not found in the regular directory, another location can be specified
with the environment variable ‘TEXTDOMAINDIR’.

   When used with the ‘-s’ option the program behaves like the ‘echo’
command.  But it does not simply copy its arguments to stdout.  Instead
those messages found in the selected catalog are translated.  Also, a
newline is added at the end, unless either the option ‘-n’ is specified
or the option ‘-e’ is specified and some of the argument strings
contains a ‘\c’ escape sequence.

   Note: ‘xgettext’ supports only the one-argument form of the ‘gettext’
invocation, where no options are present and the TEXTDOMAIN is implicit,
from the environment.

© manpagez.com 2000-2026
Individual documents may contain additional copyright information.