summaryrefslogtreecommitdiff
path: root/gettext-runtime/doc/rt-gettext.texi
blob: dc6a9769302211a6db7b82e2cf34f831cb14b197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
@c This file is part of the GNU gettext manual.
@c Copyright (C) 1995-2019 Free Software Foundation, Inc.
@c See the file gettext.texi for copying conditions.

@pindex gettext
@cindex @code{gettext} program, usage
@example
gettext [@var{option}] [[@var{textdomain}] @var{msgid}]
gettext [@var{option}] -s [@var{msgid}]...
@end example

@cindex lookup message translation
The @code{gettext} program displays the native language translation of a
textual message.

@noindent @strong{Arguments}

@table @samp
@item -c @var{context}
@itemx --context=@var{context}
@opindex -c@r{, @code{gettext} option}
@opindex --context@r{, @code{gettext} option}
Specify the context for the messages to be translated.
See @ref{Contexts} for details.

@item -d @var{textdomain}
@itemx --domain=@var{textdomain}
@opindex -d@r{, @code{gettext} option}
@opindex --domain@r{, @code{gettext} option}
Retrieve translated messages from @var{textdomain}.  Usually a @var{textdomain}
corresponds to a package, a program, or a module of a program.

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

@item -E
@opindex -E@r{, @code{gettext} option}
This option is only for compatibility with the @samp{echo} program or shell
built-in.  It has no effect.

@item -h
@itemx --help
@opindex -h@r{, @code{gettext} option}
@opindex --help@r{, @code{gettext} option}
Display this help and exit.

@item -n
@opindex -n@r{, @code{gettext} option}
This option has only an effect if the @code{-s} option is given.  It
suppresses the additional newline at the end.

@item -V
@itemx --version
@opindex -V@r{, @code{gettext} option}
@opindex --version@r{, @code{gettext} option}
Output version information and exit.

@item [@var{textdomain}] @var{msgid}
Retrieve translated message corresponding to @var{msgid} from @var{textdomain}.

@end table

If the @var{textdomain} parameter is not given, the domain is determined from
the environment variable @code{TEXTDOMAIN}.  If the message catalog is not
found in the regular directory, another location can be specified with the
environment variable @code{TEXTDOMAINDIR}.

When used with the @code{-s} option the program behaves like the @samp{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 @code{-n} is specified or the
option @code{-e} is specified and some of the argument strings contains a
@samp{\c} escape sequence.