• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@c This file is part of the GNU gettext manual.
2@c Copyright (C) 1995-2019 Free Software Foundation, Inc.
3@c See the file gettext.texi for copying conditions.
4
5@pindex gettext
6@cindex @code{gettext} program, usage
7@example
8gettext [@var{option}] [[@var{textdomain}] @var{msgid}]
9gettext [@var{option}] -s [@var{msgid}]...
10@end example
11
12@cindex lookup message translation
13The @code{gettext} program displays the native language translation of a
14textual message.
15
16@noindent @strong{Arguments}
17
18@table @samp
19@item -c @var{context}
20@itemx --context=@var{context}
21@opindex -c@r{, @code{gettext} option}
22@opindex --context@r{, @code{gettext} option}
23Specify the context for the messages to be translated.
24See @ref{Contexts} for details.
25
26@item -d @var{textdomain}
27@itemx --domain=@var{textdomain}
28@opindex -d@r{, @code{gettext} option}
29@opindex --domain@r{, @code{gettext} option}
30Retrieve translated messages from @var{textdomain}.  Usually a @var{textdomain}
31corresponds to a package, a program, or a module of a program.
32
33@item -e
34@opindex -e@r{, @code{gettext} option}
35Enable expansion of some escape sequences.  This option is for compatibility
36with the @samp{echo} program or shell built-in.  The escape sequences
37@samp{\a}, @samp{\b}, @samp{\c}, @samp{\f}, @samp{\n}, @samp{\r}, @samp{\t},
38@samp{\v}, @samp{\\}, and @samp{\} followed by one to three octal digits, are
39interpreted like the System V @samp{echo} program did.
40
41@item -E
42@opindex -E@r{, @code{gettext} option}
43This option is only for compatibility with the @samp{echo} program or shell
44built-in.  It has no effect.
45
46@item -h
47@itemx --help
48@opindex -h@r{, @code{gettext} option}
49@opindex --help@r{, @code{gettext} option}
50Display this help and exit.
51
52@item -n
53@opindex -n@r{, @code{gettext} option}
54This option has only an effect if the @code{-s} option is given.  It
55suppresses the additional newline at the end.
56
57@item -V
58@itemx --version
59@opindex -V@r{, @code{gettext} option}
60@opindex --version@r{, @code{gettext} option}
61Output version information and exit.
62
63@item [@var{textdomain}] @var{msgid}
64Retrieve translated message corresponding to @var{msgid} from @var{textdomain}.
65
66@end table
67
68If the @var{textdomain} parameter is not given, the domain is determined from
69the environment variable @code{TEXTDOMAIN}.  If the message catalog is not
70found in the regular directory, another location can be specified with the
71environment variable @code{TEXTDOMAINDIR}.
72
73When used with the @code{-s} option the program behaves like the @samp{echo}
74command.  But it does not simply copy its arguments to stdout.  Instead those
75messages found in the selected catalog are translated.  Also, a newline is
76added at the end, unless either the option @code{-n} is specified or the
77option @code{-e} is specified and some of the argument strings contains a
78@samp{\c} escape sequence.
79