SVN commit 1170445 by ilic: Moved documentation to user manual. M +6 -22 apply_filter.py M +5 -16 apply_header_filter.py M +2 -18 bad_patterns.py M +8 -8 check_grammar.py M +3 -56 check_rules.py --- trunk/l10n-support/pology/sieve/apply_filter.py #1170444:1170445 @@ -1,25 +1,10 @@ # -*- coding: UTF-8 -*- """ -Apply filters to translation. +Apply hooks to translation. -Pass C{msgstr} fields through a combination of L{hooks}, of types: - - F1A (C{(text)->text}) or F3A/C (C{(text/msgstr, msg, cat)->msgstr}), - to modify the translation - - V1A (C{(text)->spans}) or V3A/C (C{(text/msgstr, msg, cat)->spans}), - to validate the translation - - S1A (C{(text)->spans}) or S3A/C (C{(text/msgstr, msg, cat)->spans}), - for side-effects on translation (e.g. simpler checks which write notes - to standard output, rather than reporting erroneous spans as V* hooks) +Documented in C{doc/user/sieving.docbook}. -Sieve parameters: - - C{filter:}: hook specification (see L{getfunc.get_hook_ireq} - for the format of hook specifications). - Can be repeated to chain several hooks, which are applied - in the order of appearance in the command line. - - C{showmsg}: report every modified message to standard output - (for validation hooks, message is automatically output if not valid). - @author: Chusslove Illich (Часлав Илић) @license: GPLv3 """ @@ -35,15 +20,14 @@ def setup_sieve (p): p.set_desc(_("@info sieve discription", - "Apply filters to translation." + "Apply hooks to translation." "\n\n" - "Message's msgstr fields are passed through one or composition of " - "F1A, F3A/C, V1A, V3A/C, S1A, S3A/C hooks, as filters. " - "See documentation on pology for details about hooks." + "Message msgstr fields are passed through one or more of " + "F1A, F3A/C, V1A, V3A/C, S1A, S3A/C hooks." )) add_param_filter(p, _("@info sieve parameter discription", - "Specification of hook through which msgstr fields are to be filtered." + "Specification of the hook through which msgstr fields are passed." )) p.add_param("showmsg", bool, defval=False, desc=_("@info sieve parameter discription", --- trunk/l10n-support/pology/sieve/apply_header_filter.py #1170444:1170445 @@ -1,20 +1,10 @@ # -*- coding: UTF-8 -*- """ -Apply filters to headers. +Apply hooks to headers. -Pass catalog headers through a combination of L{hooks}, of types: - - F4B (C{(hdr, cat)->numerr}) to modify the header - - V4B (C{(hdr, cat)->spans}) to validate the header - - S4B (C{(hdr, cat)->numerr}) for side-effects on the header +Documented in C{doc/user/sieving.docbook}. -Sieve parameters: - - C{filter:}: hook specification (see L{getfunc.get_hook_ireq} - for the format of hook specifications) - -Parameter C{filter} can be repeated to chain several hooks, -which are then applied in the order of appearance in the command line. - @author: Chusslove Illich (Часлав Илић) @license: GPLv3 """ @@ -29,15 +19,14 @@ def setup_sieve (p): p.set_desc(_("@info sieve discription", - "Apply filters to header." + "Apply hooks to header." "\n\n" - "Catalog header is passed through one or composition of " + "Catalog header is passed through one or more of " "F4B, V4B, S4B hooks. " - "See documentation on pology for details about hooks." )) add_param_filter(p, _("@info sieve parameter discription", - "Specification of hook through which headers are to be filtered." + "Specification of the hook through which headers are passed." )) --- trunk/l10n-support/pology/sieve/bad_patterns.py #1170444:1170445 @@ -3,26 +3,10 @@ """ Check for presence of bad patterns in translation. -Sometimes there are simply definable patterns that should never appear -in translation, such as common grammar or orthographical errors. -This sieve allows checking for such patterns, either through substring -matching or regular expressions. -Patterns can be given as parameters, or, more conveniently, read from files. +Documented in C{doc/user/sieving.docbook}. -Sieve parameters: - - C{pattern:}: pattern to check against - - C{fromfile:}: file from which to read patterns - - C{rxmatch}: patterns should be treated as regular expressions - - C{casesens}: patterns should be treated as case-sensitive +@note: Deprecated. -Any number of C{pattern} and C{fromfile} parameters may be given. -By default, patterns are matched as substrings, and C{rxmatch} parameter -can be issued to consider patterns as regular expressions. - -@note: This sieve is deprecated; instead use the -L{check-rules}, which provides much more options -for defining, matching, and reporting problems. - @author: Chusslove Illich (Часлав Илић) @license: GPLv3 """ --- trunk/l10n-support/pology/sieve/check_grammar.py #1170444:1170445 @@ -1,8 +1,10 @@ # -*- coding: UTF-8 -*- """ -Sieves messages with the LanguageTool grammar checker (http://www.languagetool.org) +Check language of translation using LanguageTool. +Documented in C{doc/user/sieving.docbook}. + @author: Sébastien Renard @license: GPLv3 """ @@ -24,15 +26,13 @@ def setup_sieve (p): p.set_desc(_("@info sieve discription", - "Check language of translation using the LanguageTool checker." + "Check language of translation using LanguageTool." "\n\n" "LanguageTool (http://www.languagetool.org) is an open source " "language checker, which may be used as a standalone application, " "or in server-client mode. " - "This sieve makes use of the latter; the server can easily be " - "run locally, and can be downloaded from LanguageTools' web site. " - "Also check the web site for the list of supported languages, " - "and to which extent they are supported (number of rules)." + "This sieve runs in client-server mode, so make sure Language Tool " + "is running before this sieve is run." )) p.add_param("lang", unicode, defval=None, @@ -125,8 +125,8 @@ def finalize (self): if self.nmatch: msg = n_("@info:progress", - "Detected %(num)d problem in grammar.", - "Detected %(num)d problems in grammar.", + "Detected %(num)d problem in grammar and style.", + "Detected %(num)d problems in grammar and style.", num=self.nmatch) report("===== " + msg) --- trunk/l10n-support/pology/sieve/check_rules.py #1170444:1170445 @@ -1,65 +1,12 @@ # -*- coding: UTF-8 -*- """ -Try to fail messages by rules and warn when that happens. +Apply language- and project-dependent validation rules to messages. -This sieve applies a collection of L{special rules} to -messages, reporting whenever a rule "fails" a message -- -rules are usually written to detect messages faulty, or possibly such, -in a certain sense. +Documented in C{doc/user/sieving.docbook}. -By default, the sieve reads rules from Pology's internal C{lang//rules/} -directories, i.e. written for specific languages, and possibly specific -translation environments within a given language. Read about how to write -rules and create rule files in the L{rules} module documentation. - -The sieve parameters are: - - C{lang:}: language for which to fetch and apply the rules - - C{env:}: comma-separated list of specific environments - within the given language for which to apply the rules - - C{envonly}: when specific environments are given, apply only the rules - explicitly belonging to them (ignoring environment-agnostic ones) - - C{rule:}: comma-separated list of specific rules to apply, - by their identifiers; also enables any disabled rule among the selected - - C{rulerx:}: specific rules to apply, those whose identifiers match - the regular expression - - C{norule:}: comma-separated list of specific rules not to apply - - C{norulerx:}: regular expression for specific rules not to apply - - C{stat}: show statistics of rule matching at the end - - C{accel:}: characters to consider as accelerator markers - - C{markup:}: markup types by keyword (comma separated) - - C{xml:}: output results of the run in XML format file - - C{rfile:}: read rules from this file, instead of from - Pology's internal rule files - - C{rdir:}: read rules from this directory, instead of from - Pology's internal rule files - - C{branch:}: check only messages from this branch (summit) - - C{showfmsg}: show filtered message too when a rule fails a message - - C{nomsg}: do not show message content, only problem descriptions - - C{lokalize}: open catalogs at failed messages in Lokalize - -Parameters C{accel} and C{markup} set accelerator markers (e.g. C{_}, C{&}, -etc.) and markup types by keyword (e.g. C{xml}, C{html}, etc.) that may -be present in sieved catalogs. However, providing this information by itself -does nothing, it is only forced on catalogs (overriding what their headers -state, if anything) such that filter and validation hooks can properly -process messages. See documentation to L{rules} for setting -up these in rule files. - -If language and environment are not given by C{lang} and C{env} parameters, -the sieve will try to read them from each catalog in turn. -See catalog L{language()} and -L{environment()} methods for the ways -these can be specified in catalog header. -If in the end no environment is selected, only environment-agnostic rules -are applied. - -Certain rules may be selectively disabled on a given message, by listing -their identifiers (C{id=} rule property) in C{skip-rule:} embedded list:: - - # skip-rule: ruleid1, ruleid1, ... - @author: Sébastien Renard +@author: Chusslove Illich @license: GPLv3 """