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