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