Package pology :: Module gtxtools

Module gtxtools

Wrappers for commands from Gettext tools.


Author: Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>

License: GPLv3

Functions
(filepath) -> numerr
msgfilter(filtr, options=[])
Pass PO file through msgfilter(1) [hook factory].
(filepath) -> numerr
msgfmt(options=[])
Pass PO file through msgfmt(1) [hook factory].
Variables
  __package__ = 'pology'
Function Details

msgfilter(filtr, options=[])

 

Pass PO file through msgfilter(1) [hook factory].

Wrappers modify PO files in place; the executed command is:

   msgfilter <options> -i <filepath> -o <filepath> <filtr>

where options parameter may be used to pass any extra options to msgfilter. Both filtr and options are lists of command line arguments rather than monolithic strings, to avoid shell quoting problems. For example, to rewrap the PO file at 70 columns:

   msgfilter(["cat"], ["-w", "70"])

or to replace every foo with bar in translation:

   msgfilter(["sed", "s/foo/bar/g"])
Parameters:
  • filtr ([string*]) - filter to use
  • options ([string*]) - additional options to pass to msgfilter
Returns: (filepath) -> numerr
type F6A hook

Note: In case msgfilter does not finish without errors, wrapper always reports number of errors as 1.

msgfmt(options=[])

 

Pass PO file through msgfmt(1) [hook factory].

The file is not modified; the executed command is:

   msgfilter <options> -o /dev/null <filepath>

where options parameter may be used to pass any extra options to msgfmt. options is a list of command line arguments rather than a monolithic string, to avoid shell quoting problems.

Parameters:
  • options ([string*]) - additional options to pass to msgfmt
Returns: (filepath) -> numerr
type S6A hook

Note: In case msgfmt does not finish without errors, wrapper always reports number of errors as 1.