aboutsummaryrefslogtreecommitdiff
path: root/doc/xopo.rst
blob: b10c0da36e501992addf68ef928c78bc138dafcc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

xopo
====

The `xopo` utility filters ".pot" files generated by the
:manpage:`xgettext(1)` utility to remove formatting information
suitable for use with the "{G:}" modifier.  This means that when the
developer changes the formatting portion of the field definitions, or
the fields modifiers, the string passed to :manpage:`gettext(3)` is
unchanged, avoiding the expense of updating any existing translation
files (".po" files).

The syntax for the xopo command is one of two forms; it can be used as
a filter for processing a .po or .pot file, rewriting the "*msgid*"
strings with a simplified message string.  In this mode, the input is
either standard input or a file given by the "-f" option, and the
output is either standard output or a file given by the "-o" option.

In the second mode, a simple message given using the "-s" option on
the command, and the simplified version of that message is printed on
stdout:

  =========== =================================
   Option      Meaning
  =========== =================================
   -o <file>   Output file name
   -f <file>   Use the given .po file as input
   -s <text>   Simplify a format string
  =========== =================================

::

    EXAMPLE:
        % xopo -s "There are {:count/%u} {:event/%.6s} events\n"
        There are {:count} {:event} events\n

	% xgettext --default-domain=foo --no-wrap \
	    --add-comments --keyword=xo_emit --keyword=xo_emit_h \
	    --keyword=xo_emit_warn -C -E -n --foreign-user \
	    -o foo.pot.raw foo.c
        % xopo -f foo.pot.raw -o foo.pot

Use of the `--no-wrap` option for `xgettext` is required to
ensure that incoming msgid strings are not wrapped across multiple
lines.