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