freebsd-nq/contrib/libxo/doc/xopo.rst
Phil Shafer 983afe3373 Import libxo-0.9.0:
- Add xo_format_is_numeric() with improved logic to decide if format
  strings are numeric, so json output quotes them
- Convert docs to sphinx/rst
- update tests

Includes fix for PR 221676:
27d3021cc3 (diff-5a0d468963477f7daedb8308c219dd80)

PR:		 221676
MFC after:	5 days
2018-05-23 01:20:31 +00:00

46 lines
1.6 KiB
ReStructuredText

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.