Package translate :: Package filters :: Module checks |
[hide private]
[frames] | no frames]

# Module checks

source code

This is a set of validation checks that can be performed on translation units.

Derivatives of UnitChecker (like StandardUnitChecker) check translation units, and derivatives of TranslationChecker (like StandardChecker) check (source, target) translation pairs.

When adding a new test here, please document and explain the behaviour on the wiki.

Classes | [hide private]
| FilterFailure This exception signals that a Filter didn't pass, and gives an explanation or a comment
| SeriousFilterFailure This exception signals that a Filter didn't pass, and the bad translation might break an application (so the string will be marked fuzzy)
| CheckerConfig object representing the configuration of a checker
| UnitChecker Parent Checker class which does the checking based on functions available in derived classes.
| TranslationChecker A checker that passes source and target strings to the checks, not the whole unit.
| TeeChecker A Checker that controls multiple checkers.
| StandardChecker The basic test suite for source -> target translations.
| OpenOfficeChecker
| MozillaChecker
| DrupalChecker
| GnomeChecker
| KdeChecker
| CCLicenseChecker
| StandardUnitChecker The standard checks for common checks on translation units.

Functions | [hide private]
tagname(string) Returns the name of the XML/HTML tag in string | source code
intuplelist(pair, list) Tests to see if pair == (a,b,c) is in list, but handles None entries in list as wildcards (only allowed in positions "a" and "c"). | source code
tagproperties(strings, ignore) Returns all the properties in the XML/HTML tag string as (tagname, propertyname, propertyvalue), but ignore those combinations specified in ignore. | source code
cache_results(f) | source code
runtests(str1, str2, ignorelist=()) verifies that the tests pass for a pair of strings | source code
batchruntests(pairs) runs test on a batch of string pairs | source code

Variables | [hide private]
| xliff = `None` Parse an instance of this class from the start of the given string.
| printf_pat = `re.compile('%((?:(?P<ord>\d+)\$|\((?P<key>\w+)\))`...``
| tagname_re = `re.compile("<[\s]*([\w\/]*)")`
| property_re = `re.compile(" (\w*)=((\\\\?\".*?\\\\?\")|(\\\\?'.`...``
| tag_re = `re.compile("<[^>]+>")`
| gconf_attribute_re = `re.compile('"[a-z_]+?"')`
| common_ignoretags = `[(None, "xml-lang", None)]`
| common_canchangetags = `[("img", "alt", None)]`
| openofficeconfig = `CheckerConfig(accelmarkers= ["~"], varmatch`...``
| mozillaconfig = `CheckerConfig(accelmarkers= ["&"], varmatches=`...``
| drupalconfig = `CheckerConfig(varmatches= [("%", None), ("@", N`...``
| gnomeconfig = `CheckerConfig(accelmarkers= ["_"], varmatches= [`...``
| kdeconfig = `CheckerConfig(accelmarkers= ["&"], varmatches= [("`...``
| cclicenseconfig = `CheckerConfig(varmatches= [("@", "@")])`
| projectcheckers = `{"openoffice": OpenOfficeChecker, "mozilla":`...``

Imports: helpers, decoration, prefilters, spelling, factory, data, re

Function Details | [hide private]

### intuplelist(pair, list) | source code
Tests to see if pair == (a,b,c) is in list, but handles None entries in list as wildcards (only allowed in positions "a" and "c"). We take a shortcut by only considering "c" if "b" has already matched.

Variables Details | [hide private]

  ### printf_pat Value:
      re.compile('%((?:(?P<ord>\d+)\$|\((?P<key>\w+)\))?(?P<fullvar>[+#-]*(?
      :\d+)?(?:\.\d+)?(hh\|h\|l\|ll)?(?P<type>[\w%])))')

  ### property_re Value:
      re.compile(" (\w*)=((\\\\?\".*?\\\\?\")|(\\\\?'.*?\\\\?'))")

  ### openofficeconfig Value:
      CheckerConfig(accelmarkers= ["~"], varmatches= [("&", ";"), ("%", "%")
      , ("%", None), ("%", 0), ("$(", ")"), ("$", "$"), ("${", "}"), ("#", "
      #"), ("#", 1), ("#", 0), ("($", ")"), ("$[", "]"), ("[", "]"), ("$", N
      one)], ignoretags= [("alt", "xml-lang", None), ("ahelp", "visibility",
       "visible"), ("img", "width", None), ("img", "height", None)], canchan
      getags= [("link", "name", None)])

  ### mozillaconfig Value:
      CheckerConfig(accelmarkers= ["&"], varmatches= [("&", ";"), ("%", "%")
      , ("%", 1), ("$", "$"), ("$", None), ("#", 1), ("${", "}"), ("$(^", ")
      ")], criticaltests= ["accelerators"])

  ### drupalconfig Value:
      CheckerConfig(varmatches= [("%", None), ("@", None), ("!", None)],)

  ### gnomeconfig Value:
      CheckerConfig(accelmarkers= ["_"], varmatches= [("%", 1), ("$(", ")")]
      , credit_sources= [u"translator-credits"])

  ### kdeconfig Value:
      CheckerConfig(accelmarkers= ["&"], varmatches= [("%", 1)], credit_sour
      ces= [u"Your names", u"Your emails", u"ROLES_OF_TRANSLATORS"])

  ### projectcheckers Value:
      {"openoffice": OpenOfficeChecker, "mozilla": MozillaChecker, "kde": Kd
      eChecker, "wx": KdeChecker, "gnome": GnomeChecker, "creativecommons":
      CCLicenseChecker, "drupal": DrupalChecker,}