xref: /freebsd/contrib/libxo/doc/xopo.rst (revision 76afb20c58adb296f09857aed214b91464242264)
1*983afe33SPhil Shafer
2*983afe33SPhil Shaferxopo
3*983afe33SPhil Shafer====
4*983afe33SPhil Shafer
5*983afe33SPhil ShaferThe `xopo` utility filters ".pot" files generated by the
6*983afe33SPhil Shafer:manpage:`xgettext(1)` utility to remove formatting information
7*983afe33SPhil Shafersuitable for use with the "{G:}" modifier.  This means that when the
8*983afe33SPhil Shaferdeveloper changes the formatting portion of the field definitions, or
9*983afe33SPhil Shaferthe fields modifiers, the string passed to :manpage:`gettext(3)` is
10*983afe33SPhil Shaferunchanged, avoiding the expense of updating any existing translation
11*983afe33SPhil Shaferfiles (".po" files).
12*983afe33SPhil Shafer
13*983afe33SPhil ShaferThe syntax for the xopo command is one of two forms; it can be used as
14*983afe33SPhil Shafera filter for processing a .po or .pot file, rewriting the "*msgid*"
15*983afe33SPhil Shaferstrings with a simplified message string.  In this mode, the input is
16*983afe33SPhil Shafereither standard input or a file given by the "-f" option, and the
17*983afe33SPhil Shaferoutput is either standard output or a file given by the "-o" option.
18*983afe33SPhil Shafer
19*983afe33SPhil ShaferIn the second mode, a simple message given using the "-s" option on
20*983afe33SPhil Shaferthe command, and the simplified version of that message is printed on
21*983afe33SPhil Shaferstdout:
22*983afe33SPhil Shafer
23*983afe33SPhil Shafer  =========== =================================
24*983afe33SPhil Shafer   Option      Meaning
25*983afe33SPhil Shafer  =========== =================================
26*983afe33SPhil Shafer   -o <file>   Output file name
27*983afe33SPhil Shafer   -f <file>   Use the given .po file as input
28*983afe33SPhil Shafer   -s <text>   Simplify a format string
29*983afe33SPhil Shafer  =========== =================================
30*983afe33SPhil Shafer
31*983afe33SPhil Shafer::
32*983afe33SPhil Shafer
33*983afe33SPhil Shafer    EXAMPLE:
34*983afe33SPhil Shafer        % xopo -s "There are {:count/%u} {:event/%.6s} events\n"
35*983afe33SPhil Shafer        There are {:count} {:event} events\n
36*983afe33SPhil Shafer
37*983afe33SPhil Shafer	% xgettext --default-domain=foo --no-wrap \
38*983afe33SPhil Shafer	    --add-comments --keyword=xo_emit --keyword=xo_emit_h \
39*983afe33SPhil Shafer	    --keyword=xo_emit_warn -C -E -n --foreign-user \
40*983afe33SPhil Shafer	    -o foo.pot.raw foo.c
41*983afe33SPhil Shafer        % xopo -f foo.pot.raw -o foo.pot
42*983afe33SPhil Shafer
43*983afe33SPhil ShaferUse of the `--no-wrap` option for `xgettext` is required to
44*983afe33SPhil Shaferensure that incoming msgid strings are not wrapped across multiple
45*983afe33SPhil Shaferlines.
46