From: Dwayne B. <dwa...@us...> - 2006-02-28 13:12:26
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26245 Modified Files: checks.py test_checks.py Log Message: Ensure that we remove KDE comments before checking if something is untranslated (also added test) Allow numbers to be reordered (also added test Added test for messages that are blank but contain a KDE comment Index: checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/checks.py,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- checks.py 20 Feb 2006 07:38:09 -0000 1.80 +++ checks.py 28 Feb 2006 13:12:22 -0000 1.81 @@ -252,6 +252,7 @@ """simply defines a bunch of tests...""" def untranslated(self, str1, str2): """checks whether a string has been translated at all""" + str2 = prefilters.removekdecomments(str2) return not (len(str1.strip()) > 0 and len(str2) == 0) def unchanged(self, str1, str2): @@ -417,7 +418,7 @@ def numbers(self, str1, str2): """checks whether numbers of various forms are consistent between the two strings""" - return helpers.funcmatch(str1, str2, decoration.getnumbers) + return helpers.countsmatch(str1, str2, decoration.getnumbers(str1)) def startwhitespace(self, str1, str2): """checks whether whitespace at the beginning of the strings matches""" Index: test_checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_checks.py,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- test_checks.py 17 Feb 2006 08:39:04 -0000 1.63 +++ test_checks.py 28 Feb 2006 13:12:22 -0000 1.64 @@ -72,6 +72,7 @@ """tests blank""" stdchecker = checks.StandardChecker() assert checks.fails(stdchecker.blank, "Save as", " ") + assert checks.fails(stdchecker.blank, "_: KDE comment\\n\nSimple string", " ") def test_brackets(): """tests brackets""" @@ -247,6 +248,8 @@ # FIXME - again locale intelligence should allow us to use other decimal seperators assert checks.fails(stdchecker.numbers, "R57.60", "R57,60") assert checks.fails(stdchecker.numbers, "1,000.00", "1 000,00") + # You should be able to reorder numbers + assert checks.passes(stdchecker.numbers, "40-bit RC2 encryption with RSA and an MD5", "Umbhalo ocashile i-RC2 onamabhithi angu-40 one-RSA ne-MD5") def test_puncspacing(): """tests spacing after punctuation""" @@ -387,6 +390,8 @@ stdchecker = checks.StandardChecker() assert checks.fails(stdchecker.untranslated, "I am untranslated", "") assert checks.passes(stdchecker.untranslated, "I am translated", "Ek is vertaal") + # KDE comments that make it into translations should not mask untranslated test + assert checks.fails(stdchecker.untranslated, "_: KDE comment\\n\nI am untranslated", "_: KDE comment\\n\n") def test_validchars(): """tests valid characters""" |