xopo

The xopo utility filters “.pot” files generated by the 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 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.