Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / doc / msgexec.texi
1 @pindex msgexec
2 @cindex @code{msgexec} program, usage
3 @example
4 msgexec [@var{option}] @var{command} [@var{command-option}]
5 @end example
6
7 @cindex apply command to all translations in a catalog
8 The @code{msgexec} program applies a command to all translations of a
9 translation catalog.
10 The @var{command} can be any program that reads a translation from standard
11 input.  It is invoked once for each translation.  Its output becomes
12 msgexec's output.  @code{msgexec}'s return code is the maximum return code
13 across all invocations.
14
15 @cindex @code{xargs}, and output from @code{msgexec}
16 A special builtin command called @samp{0} outputs the translation, followed
17 by a null byte.  The output of @samp{msgexec 0} is suitable as input for
18 @samp{xargs -0}.
19
20 @table @samp
21 @item --newline
22 @opindex --newline@r{, @code{msgfilter} option}
23 Add newline at the end of each input line.
24
25 @end table
26
27 @vindex MSGEXEC_MSGCTXT@r{, environment variable}
28 @vindex MSGEXEC_MSGID@r{, environment variable}
29 @vindex MSGEXEC_MSGID_PLURAL@r{, environment variable}
30 @vindex MSGEXEC_LOCATION@r{, environment variable}
31 @vindex MSGEXEC_PLURAL_FORM@r{, environment variable}
32 @vindex MSGEXEC_PREV_MSGCTXT@r{, environment variable}
33 @vindex MSGEXEC_PREV_MSGID@r{, environment variable}
34 @vindex MSGEXEC_PREV_MSGID_PLURAL@r{, environment variable}
35 During each @var{command} invocation, the environment variable
36 @code{MSGEXEC_MSGID} is bound to the message's msgid, and the environment
37 variable @code{MSGEXEC_LOCATION} is bound to the location in the PO file
38 of the message.  If the message has a context, the environment variable
39 @code{MSGEXEC_MSGCTXT} is bound to the message's msgctxt, otherwise it is
40 unbound.  If the message has a plural form, environment variable
41 @code{MSGEXEC_MSGID_PLURAL} is bound to the message's msgid_plural and
42 @code{MSGEXEC_PLURAL_FORM} is bound to the order number of the plural
43 actually processed (starting with 0), otherwise both are unbound.
44 If the message has a previous msgid (added by @code{msgmerge}),
45 environment variable @code{MSGEXEC_PREV_MSGCTXT} is bound to the
46 message's previous msgctxt, @code{MSGEXEC_PREV_MSGID} is bound to
47 the previous msgid, and @code{MSGEXEC_PREV_MSGID_PLURAL} is bound to
48 the previous msgid_plural.
49
50 @cindex catalog encoding and @code{msgexec} output
51 Note: It is your responsibility to ensure that the @var{command} can cope
52 with input encoded in the translation catalog's encoding.  If the
53 @var{command} wants input in a particular encoding, you can in a first step
54 convert the translation catalog to that encoding using the @samp{msgconv}
55 program, before invoking @samp{msgexec}.  If the @var{command} wants input
56 in the locale's encoding, but you want to avoid the locale's encoding, then
57 you can first convert the translation catalog to UTF-8 using the
58 @samp{msgconv} program and then make @samp{msgexec} work in an UTF-8
59 locale, by using the @code{LC_ALL} environment variable.
60
61 @subsection Input file location
62
63 @table @samp
64 @item -i @var{inputfile}
65 @itemx --input=@var{inputfile}
66 @opindex -i@r{, @code{msgexec} option}
67 @opindex --input@r{, @code{msgexec} option}
68 Input PO file.
69
70 @item -D @var{directory}
71 @itemx --directory=@var{directory}
72 @opindex -D@r{, @code{msgexec} option}
73 @opindex --directory@r{, @code{msgexec} option}
74 Add @var{directory} to the list of directories.  Source files are
75 searched relative to this list of directories.  The resulting @file{.po}
76 file will be written relative to the current directory, though.
77
78 @end table
79
80 If no @var{inputfile} is given or if it is @samp{-}, standard input is read.
81
82 @subsection Input file syntax
83
84 @table @samp
85 @item -P
86 @itemx --properties-input
87 @opindex -P@r{, @code{msgexec} option}
88 @opindex --properties-input@r{, @code{msgexec} option}
89 Assume the input file is a Java ResourceBundle in Java @code{.properties}
90 syntax, not in PO file syntax.
91
92 @item --stringtable-input
93 @opindex --stringtable-input@r{, @code{msgexec} option}
94 Assume the input file is a NeXTstep/GNUstep localized resource file in
95 @code{.strings} syntax, not in PO file syntax.
96
97 @end table
98
99 @subsection Informative output
100
101 @table @samp
102 @item -h
103 @itemx --help
104 @opindex -h@r{, @code{msgexec} option}
105 @opindex --help@r{, @code{msgexec} option}
106 Display this help and exit.
107
108 @item -V
109 @itemx --version
110 @opindex -V@r{, @code{msgexec} option}
111 @opindex --version@r{, @code{msgexec} option}
112 Output version information and exit.
113
114 @end table