Package pology :: Module bpatterns

Module bpatterns

Detect unwanted patterns in translation.


Note: This module is deprecated. Use rules through check-rules sieve instead.

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

License: GPLv3

Functions
(text, msg, cat)->numerr
bad_patterns(rxmatch=False, casesens=True, patterns=None, fromfiles=None)
Detect unwanted patterns in text [hook factory].
(msg, cat)->numerr
bad_patterns_msg(rxmatch=False, casesens=True, patterns=None, fromfiles=None)
Detect unwanted patterns in translation [hook factory].
(msg, cat)->parts
bad_patterns_msg_sp(rxmatch=False, casesens=True, patterns=None, fromfiles=None)
Detect unwanted patterns in translation, report spans [hook factory].
Variables
  __package__ = 'pology'
Function Details

bad_patterns(rxmatch=False, casesens=True, patterns=None, fromfiles=None)

 

Detect unwanted patterns in text [hook factory].

Patterns can be given both as list of strings, and as a list of file paths containing patterns (in each file: one pattern per line, strip leading and trailing whitespace, skip empty lines, #-comments). Detected patterns are reported to stdout.

If rxmatch is False, patterns are matched by plain substring search, otherwise as regular expressions. If casesens is True, matching is case sensitive.

If the message has pipe flag no-bad-patterns, check is skipped.

Parameters:
  • rxmatch (bool) - whether to take pattern as regular expression
  • casesens (bool) - whether the match should be case-sensitive
  • patterns (list of strings) - patterns to match the text
  • fromfiles (list of strings) - file paths from which to read patterns
Returns: (text, msg, cat)->numerr
type S3A hook

bad_patterns_msg(rxmatch=False, casesens=True, patterns=None, fromfiles=None)

 

Detect unwanted patterns in translation [hook factory].

Like bad_patterns, but checks and reports on all msgstr fields in the message.

Returns: (msg, cat)->numerr
type S4A hook

bad_patterns_msg_sp(rxmatch=False, casesens=True, patterns=None, fromfiles=None)

 

Detect unwanted patterns in translation, report spans [hook factory].

Like bad_patterns_msg, but reports parts instead of writing to stdout.

Returns: (msg, cat)->parts
type V4A hook