You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(44) |
Feb
(105) |
Mar
(180) |
Apr
(102) |
May
(206) |
Jun
(115) |
Jul
(181) |
Aug
(290) |
Sep
(26) |
Oct
(316) |
Nov
(175) |
Dec
(151) |
2005 |
Jan
(102) |
Feb
(68) |
Mar
(112) |
Apr
(115) |
May
(125) |
Jun
(75) |
Jul
(40) |
Aug
(33) |
Sep
(29) |
Oct
(39) |
Nov
(58) |
Dec
(65) |
2006 |
Jan
(104) |
Feb
(220) |
Mar
(207) |
Apr
(168) |
May
(203) |
Jun
(501) |
Jul
(201) |
Aug
(371) |
Sep
(123) |
Oct
(177) |
Nov
(210) |
Dec
(299) |
2007 |
Jan
(226) |
Feb
(303) |
Mar
(131) |
Apr
(208) |
May
(186) |
Jun
(304) |
Jul
(185) |
Aug
(186) |
Sep
(228) |
Oct
(66) |
Nov
(46) |
Dec
(45) |
2008 |
Jan
(191) |
Feb
(77) |
Mar
(59) |
Apr
(199) |
May
(174) |
Jun
(199) |
Jul
(265) |
Aug
(283) |
Sep
(315) |
Oct
(283) |
Nov
(170) |
Dec
(471) |
2009 |
Jan
(572) |
Feb
(232) |
Mar
(455) |
Apr
(208) |
May
(284) |
Jun
(536) |
Jul
(353) |
Aug
(126) |
Sep
(78) |
Oct
(431) |
Nov
(643) |
Dec
(162) |
2010 |
Jan
(140) |
Feb
(141) |
Mar
(257) |
Apr
(296) |
May
(274) |
Jun
(145) |
Jul
(403) |
Aug
(448) |
Sep
(245) |
Oct
(435) |
Nov
(398) |
Dec
(254) |
2011 |
Jan
(224) |
Feb
(27) |
Mar
(44) |
Apr
(70) |
May
(104) |
Jun
(63) |
Jul
(32) |
Aug
(97) |
Sep
(147) |
Oct
(74) |
Nov
(26) |
Dec
(13) |
2012 |
Jan
(34) |
Feb
(58) |
Mar
(102) |
Apr
(99) |
May
(43) |
Jun
(53) |
Jul
(49) |
Aug
(38) |
Sep
(72) |
Oct
(144) |
Nov
(72) |
Dec
(76) |
2013 |
Jan
(7) |
Feb
(44) |
Mar
(117) |
Apr
(104) |
May
(159) |
Jun
(70) |
Jul
(42) |
Aug
(36) |
Sep
(48) |
Oct
(53) |
Nov
(167) |
Dec
(56) |
2014 |
Jan
(97) |
Feb
(179) |
Mar
(121) |
Apr
(77) |
May
(65) |
Jun
(74) |
Jul
(95) |
Aug
(40) |
Sep
(39) |
Oct
(111) |
Nov
(73) |
Dec
(12) |
2015 |
Jan
(4) |
Feb
(1) |
Mar
(11) |
Apr
(13) |
May
(39) |
Jun
(5) |
Jul
(1) |
Aug
(53) |
Sep
(25) |
Oct
(3) |
Nov
|
Dec
(2) |
2016 |
Jan
(4) |
Feb
(30) |
Mar
(77) |
Apr
(14) |
May
(26) |
Jun
(9) |
Jul
(16) |
Aug
(40) |
Sep
(12) |
Oct
(34) |
Nov
(20) |
Dec
(24) |
2017 |
Jan
(68) |
Feb
(13) |
Mar
(33) |
Apr
(20) |
May
(18) |
Jun
(49) |
Jul
(13) |
Aug
(18) |
Sep
(41) |
Oct
(4) |
Nov
(52) |
Dec
(7) |
2018 |
Jan
(10) |
Feb
(19) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2019 |
Jan
(4) |
Feb
(33) |
Mar
(5) |
Apr
(10) |
May
(20) |
Jun
(55) |
Jul
(15) |
Aug
(16) |
Sep
(12) |
Oct
(35) |
Nov
(11) |
Dec
(14) |
2020 |
Jan
(50) |
Feb
(22) |
Mar
(8) |
Apr
(52) |
May
(39) |
Jun
(60) |
Jul
(39) |
Aug
(32) |
Sep
(62) |
Oct
(52) |
Nov
(44) |
Dec
(64) |
2021 |
Jan
(53) |
Feb
(50) |
Mar
(61) |
Apr
(66) |
May
(71) |
Jun
(44) |
Jul
(58) |
Aug
(55) |
Sep
(36) |
Oct
(34) |
Nov
(56) |
Dec
(42) |
2022 |
Jan
(191) |
Feb
(39) |
Mar
(33) |
Apr
(35) |
May
(38) |
Jun
(64) |
Jul
(53) |
Aug
(51) |
Sep
(33) |
Oct
(42) |
Nov
(38) |
Dec
(43) |
2023 |
Jan
(76) |
Feb
(57) |
Mar
(46) |
Apr
(49) |
May
(72) |
Jun
(49) |
Jul
(54) |
Aug
(59) |
Sep
(70) |
Oct
(65) |
Nov
(90) |
Dec
(47) |
2024 |
Jan
(34) |
Feb
(58) |
Mar
(44) |
Apr
(38) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dwayne B. <dwa...@us...> - 2006-06-01 15:16:47
|
Update of /cvsroot/translate/src/Pootle In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv32394 Modified Files: Tag: wordforge-0-9-branch test_client.py Log Message: [Sidewaysport] from Pootle-locking branch. Less verbose logging. Add submit translations test. Index: test_client.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/test_client.py,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -u -d -r1.11.2.1 -r1.11.2.2 --- test_client.py 1 Jun 2006 14:54:20 -0000 1.11.2.1 +++ test_client.py 1 Jun 2006 15:16:40 -0000 1.11.2.2 @@ -68,7 +68,6 @@ assert "Log In" not in contents # check login is retained on next fetch contents = self.fetch_page("") - print contents assert "Log In" not in contents def test_non_admin_rights(self): @@ -120,7 +119,6 @@ add_language = self.fetch_page("projects/testproject/admin.html?" + add_args) assert "Test Language" in add_language language_page = self.fetch_page("zxx/testproject/") - print language_page.replace("\r", "\n") assert "Test Language" in language_page assert "Pootle Unit Tests" in language_page assert "0 files, 0/0 words (0%) translated" in language_page @@ -208,6 +206,23 @@ assert pocontents_download == mergedcontents test_upload_over_file.userprefs = {"rights.siteadmin": True} + def test_submit_translation(self): + """tests that we can upload a new file into a project""" + self.login() + podir = self.setup_testproject_dir() + pofile_storename = os.path.join(podir, "test_upload.po") + pocontents = '#: test.c\nmsgid "test"\nmsgstr "rest"\n' + open(pofile_storename, "w").write(pocontents) + expected_pocontents = '#: test.c\nmsgid "test"\nmsgstr "restrain"\n' + fields = {"orig-pure0.0": "test", "trans0": "restrain", "submit0": "submit", "pofilename": "test_upload.po"} + content_type, post_contents = postMultipart.encode_multipart_formdata(fields.items(), []) + headers = {"Content-Type": content_type, "Content-Length": len(post_contents)} + translatepage = self.post_request("zxx/testproject/test_upload.po?translate=1&editing=1", post_contents, headers) + tree = potree.POTree(self.prefs.Pootle) + project = projects.TranslationProject("zxx", "testproject", tree) + pofile = project.getpofile("test_upload.po") + assert str(pofile.units[1]) == expected_pocontents + def MakeServerTester(baseclass): """Makes a new Server Tester class using the base class to setup webserver etc""" class TestServer(baseclass, ServerTester): |
From: Dwayne B. <dwa...@us...> - 2006-06-01 15:15:04
|
Update of /cvsroot/translate/src/Pootle In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv31643 Modified Files: test_client.py Log Message: [Forwardport] from Pootle-loacking branch, fixes for expestec content on Pootle pages. Index: test_client.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/test_client.py,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- test_client.py 1 Jun 2006 15:05:02 -0000 1.12 +++ test_client.py 1 Jun 2006 15:14:56 -0000 1.13 @@ -68,7 +68,6 @@ assert "Log In" not in contents # check login is retained on next fetch contents = self.fetch_page("") - print contents assert "Log In" not in contents def test_non_admin_rights(self): @@ -120,7 +119,6 @@ add_language = self.fetch_page("projects/testproject/admin.html?" + add_args) assert "Test Language" in add_language language_page = self.fetch_page("zxx/testproject/") - print language_page.replace("\r", "\n") assert "Test Language" in language_page assert "Pootle Unit Tests" in language_page assert "0 files, 0/0 words (0%) translated" in language_page @@ -148,7 +146,7 @@ content_type, upload_contents = postMultipart.encode_multipart_formdata(fields, files) headers = {"Content-Type": content_type, "Content-Length": len(upload_contents)} response = self.post_request("zxx/testproject/", upload_contents, headers) - assert '<a href="test_upload.po">PO file</a>' in response + assert '<a href="test_upload.po?' in response pofile_storename = os.path.join(podir, "test_upload.po") assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == pocontents @@ -172,7 +170,7 @@ headers = {"Content-Type": content_type, "Content-Length": len(upload_contents)} response = self.post_request("zxx/testproject/", upload_contents, headers) for filename, contents in [("test.po", po1contents), ("frog.po", po2contents)]: - assert ('<a href="%s">PO file</a>' % filename) in response + assert ('<a href="%s?' % filename) in response pofile_storename = os.path.join(podir, filename) assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == contents @@ -208,6 +206,23 @@ assert pocontents_download == mergedcontents test_upload_over_file.userprefs = {"rights.siteadmin": True} + def test_submit_translation(self): + """tests that we can upload a new file into a project""" + self.login() + podir = self.setup_testproject_dir() + pofile_storename = os.path.join(podir, "test_upload.po") + pocontents = '#: test.c\nmsgid "test"\nmsgstr "rest"\n' + open(pofile_storename, "w").write(pocontents) + expected_pocontents = '#: test.c\nmsgid "test"\nmsgstr "restrain"\n' + fields = {"orig-pure0.0": "test", "trans0": "restrain", "submit0": "submit", "pofilename": "test_upload.po"} + content_type, post_contents = postMultipart.encode_multipart_formdata(fields.items(), []) + headers = {"Content-Type": content_type, "Content-Length": len(post_contents)} + translatepage = self.post_request("zxx/testproject/test_upload.po?translate=1&editing=1", post_contents, headers) + tree = potree.POTree(self.prefs.Pootle) + project = projects.TranslationProject("zxx", "testproject", tree) + pofile = project.getpofile("test_upload.po") + assert str(pofile.units[1]) == expected_pocontents + def MakeServerTester(baseclass): """Makes a new Server Tester class using the base class to setup webserver etc""" class TestServer(baseclass, ServerTester): |
From: Dwayne B. <dwa...@us...> - 2006-06-01 15:05:06
|
Update of /cvsroot/translate/src/Pootle In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26892 Modified Files: test_client.py Log Message: [Forwardport] Use lowercase HTML tags jsut as KID does. Index: test_client.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/test_client.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- test_client.py 26 Apr 2006 12:53:06 -0000 1.11 +++ test_client.py 1 Jun 2006 15:05:02 -0000 1.12 @@ -74,7 +74,7 @@ def test_non_admin_rights(self): """checks that without admin rights we can't access the admin screen""" contents = self.login() - adminlink = '<A href="/admin/">Admin</A>' in contents + adminlink = '<a href="/admin/">Admin</a>' in contents assert not adminlink contents = self.fetch_page("admin/") denied = "You do not have the rights to administer pootle" in contents @@ -83,7 +83,7 @@ def test_admin_rights(self): """checks that admin rights work properly""" contents = self.login() - adminlink = '<A href="/admin/">Admin</A>' in contents + adminlink = '<a href="/admin/">Admin</a>' in contents assert adminlink contents = self.fetch_page("admin/") admintitle = "<title>Pootle Admin Page</title>" in contents @@ -114,7 +114,7 @@ assert "Test Language" not in language_list assert "Pootle Unit Tests" in language_list project_admin = self.fetch_page("projects/testproject/admin.html") - assert '<OPTION value="zxx">Test Language</OPTION>' in project_admin + assert '<option value="zxx">Test Language</option>' in project_admin add_dict = {"newlanguage": "zxx", "doaddlanguage": "Add Language"} add_args = "&".join(["%s=%s" % (key, urllib.quote_plus(value)) for key, value in add_dict.items()]) add_language = self.fetch_page("projects/testproject/admin.html?" + add_args) @@ -148,7 +148,7 @@ content_type, upload_contents = postMultipart.encode_multipart_formdata(fields, files) headers = {"Content-Type": content_type, "Content-Length": len(upload_contents)} response = self.post_request("zxx/testproject/", upload_contents, headers) - assert '<A href="test_upload.po">PO file</A>' in response + assert '<a href="test_upload.po">PO file</a>' in response pofile_storename = os.path.join(podir, "test_upload.po") assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == pocontents @@ -172,7 +172,7 @@ headers = {"Content-Type": content_type, "Content-Length": len(upload_contents)} response = self.post_request("zxx/testproject/", upload_contents, headers) for filename, contents in [("test.po", po1contents), ("frog.po", po2contents)]: - assert ('<A href="%s">PO file</A>' % filename) in response + assert ('<a href="%s">PO file</a>' % filename) in response pofile_storename = os.path.join(podir, filename) assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == contents @@ -197,7 +197,7 @@ # It may be a good idea to change this mergedcontents = '#: test.c\nmsgid "test"\nmsgstr "rest"\n\n#: frog.c\nmsgid "tadpole"\nmsgstr "fish"\n\n#: toad.c\nmsgid "slink"\nmsgstr "stink"\n\n' suggestedcontents = '#: test.c\nmsgid "_: suggested by testuser"\n"test"\nmsgstr "rested"\n\n' - assert '<A href="test_existing.po">PO file</A>' in response + assert '<a href="test_existing.po">PO file</a>' in response pofile_storename = os.path.join(podir, "test_existing.po") assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == mergedcontents |
From: Dwayne B. <dwa...@us...> - 2006-06-01 14:54:25
|
Update of /cvsroot/translate/src/Pootle In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22669 Modified Files: Tag: wordforge-0-9-branch test_client.py Log Message: Use lowercase HTML tags jsut as KID does. Index: test_client.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/test_client.py,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -d -r1.11 -r1.11.2.1 --- test_client.py 26 Apr 2006 12:53:06 -0000 1.11 +++ test_client.py 1 Jun 2006 14:54:20 -0000 1.11.2.1 @@ -74,7 +74,7 @@ def test_non_admin_rights(self): """checks that without admin rights we can't access the admin screen""" contents = self.login() - adminlink = '<A href="/admin/">Admin</A>' in contents + adminlink = '<a href="/admin/">Admin</a>' in contents assert not adminlink contents = self.fetch_page("admin/") denied = "You do not have the rights to administer pootle" in contents @@ -83,7 +83,7 @@ def test_admin_rights(self): """checks that admin rights work properly""" contents = self.login() - adminlink = '<A href="/admin/">Admin</A>' in contents + adminlink = '<a href="/admin/">Admin</a>' in contents assert adminlink contents = self.fetch_page("admin/") admintitle = "<title>Pootle Admin Page</title>" in contents @@ -114,7 +114,7 @@ assert "Test Language" not in language_list assert "Pootle Unit Tests" in language_list project_admin = self.fetch_page("projects/testproject/admin.html") - assert '<OPTION value="zxx">Test Language</OPTION>' in project_admin + assert '<option value="zxx">Test Language</option>' in project_admin add_dict = {"newlanguage": "zxx", "doaddlanguage": "Add Language"} add_args = "&".join(["%s=%s" % (key, urllib.quote_plus(value)) for key, value in add_dict.items()]) add_language = self.fetch_page("projects/testproject/admin.html?" + add_args) @@ -148,7 +148,7 @@ content_type, upload_contents = postMultipart.encode_multipart_formdata(fields, files) headers = {"Content-Type": content_type, "Content-Length": len(upload_contents)} response = self.post_request("zxx/testproject/", upload_contents, headers) - assert '<A href="test_upload.po">PO file</A>' in response + assert '<a href="test_upload.po">PO file</a>' in response pofile_storename = os.path.join(podir, "test_upload.po") assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == pocontents @@ -172,7 +172,7 @@ headers = {"Content-Type": content_type, "Content-Length": len(upload_contents)} response = self.post_request("zxx/testproject/", upload_contents, headers) for filename, contents in [("test.po", po1contents), ("frog.po", po2contents)]: - assert ('<A href="%s">PO file</A>' % filename) in response + assert ('<a href="%s">PO file</a>' % filename) in response pofile_storename = os.path.join(podir, filename) assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == contents @@ -197,7 +197,7 @@ # It may be a good idea to change this mergedcontents = '#: test.c\nmsgid "test"\nmsgstr "rest"\n\n#: frog.c\nmsgid "tadpole"\nmsgstr "fish"\n\n#: toad.c\nmsgid "slink"\nmsgstr "stink"\n\n' suggestedcontents = '#: test.c\nmsgid "_: suggested by testuser"\n"test"\nmsgstr "rested"\n\n' - assert '<A href="test_existing.po">PO file</A>' in response + assert '<a href="test_existing.po">PO file</a>' in response pofile_storename = os.path.join(podir, "test_existing.po") assert os.path.isfile(pofile_storename) assert open(pofile_storename).read() == mergedcontents |
From: Dwayne B. <dwa...@us...> - 2006-06-01 14:42:12
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17513 Modified Files: Tag: wordforge-0-9-branch test_checks.py Log Message: [Backport] correct tests Index: test_checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_checks.py,v retrieving revision 1.72.2.4 retrieving revision 1.72.2.5 diff -u -d -r1.72.2.4 -r1.72.2.5 --- test_checks.py 1 Jun 2006 12:57:00 -0000 1.72.2.4 +++ test_checks.py 1 Jun 2006 14:42:06 -0000 1.72.2.5 @@ -357,7 +357,7 @@ ## If source is ALL CAPS then we should just check that target is also ALL CAPS assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") # KDE commens should be removed - assert checks.fails(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") + assert checks.passes(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") # Just some that at times have failed but should always pass assert checks.passes(stdchecker.simplecaps, "Create a query entering an SQL statement directly.", "Yakha sibuti singena SQL inkhomba yesitatimende.") ooochecker = checks.OpenOfficeChecker() |
From: Dwayne B. <dwa...@us...> - 2006-06-01 14:41:46
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17464 Modified Files: test_checks.py Log Message: Correct test Index: test_checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_checks.py,v retrieving revision 1.81 retrieving revision 1.82 diff -u -d -r1.81 -r1.82 --- test_checks.py 1 Jun 2006 12:53:05 -0000 1.81 +++ test_checks.py 1 Jun 2006 14:41:43 -0000 1.82 @@ -357,7 +357,7 @@ ## If source is ALL CAPS then we should just check that target is also ALL CAPS assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") # KDE commens should be removed - assert checks.fails(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") + assert checks.passes(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") # Just some that at times have failed but should always pass assert checks.passes(stdchecker.simplecaps, "Create a query entering an SQL statement directly.", "Yakha sibuti singena SQL inkhomba yesitatimende.") ooochecker = checks.OpenOfficeChecker() |
From: Dwayne B. <dwa...@us...> - 2006-06-01 14:27:56
|
Update of /cvsroot/translate/src/translate/convert In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv12049 Modified Files: html2po.py Log Message: Make sure that we split lines on <br> for a better PO editing experience. Index: html2po.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/html2po.py,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- html2po.py 5 May 2006 13:30:58 -0000 1.13 +++ html2po.py 1 Jun 2006 14:27:48 -0000 1.14 @@ -26,6 +26,7 @@ from translate.storage import po from translate.storage import html from translate.misc import quote +import sre class html2po: def convertfile(self, inputfile, filename, includeheader, includeuntagged=False, duplicatestyle="msgid_comment"): @@ -42,7 +43,7 @@ if not block: continue thepo = po.pounit(encoding="UTF-8") thepo.sourcecomments.append("#: %s:%d\n" % (filename,blocknum+1)) - block = block.split("\n") + block = sre.sub("<br>\n?", "<br>\n", block).split("\n") thepo.msgid = [quote.quotestr(quote.rstripeol(line)) for line in block] if len(thepo.msgid) > 1: thepo.msgid = [quote.quotestr("")] + thepo.msgid |
From: Dwayne B. <dwa...@us...> - 2006-06-01 12:57:15
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv10188 Modified Files: Tag: wordforge-0-9-branch checks.py test_checks.py Log Message: [Backport] Can now handle the allcaps case of simplecaps errors Index: test_checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_checks.py,v retrieving revision 1.72.2.3 retrieving revision 1.72.2.4 diff -u -d -r1.72.2.3 -r1.72.2.4 --- test_checks.py 1 Jun 2006 12:55:14 -0000 1.72.2.3 +++ test_checks.py 1 Jun 2006 12:57:00 -0000 1.72.2.4 @@ -355,7 +355,7 @@ assert checks.passes(stdchecker.simplecaps, "The element \"%S\" is not recognized.", "Elemente \"%S\" a yi tiveki.") assert checks.passes(stdchecker.simplecaps, "Determine how &brandShortName; connects to the Internet.", "Kuma &brandShortName; hlanganisa eka Internete.") ## If source is ALL CAPS then we should just check that target is also ALL CAPS - #assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") + assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") # KDE commens should be removed assert checks.fails(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") # Just some that at times have failed but should always pass Index: checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/checks.py,v retrieving revision 1.89.2.2 retrieving revision 1.89.2.3 diff -u -d -r1.89.2.2 -r1.89.2.3 --- checks.py 1 Jun 2006 12:55:14 -0000 1.89.2.2 +++ checks.py 1 Jun 2006 12:57:00 -0000 1.89.2.3 @@ -564,6 +564,10 @@ """checks the capitalisation of two strings isn't wildly different""" str1 = prefilters.removekdecomments(str1) capitals1, capitals2 = helpers.filtercount(str1, type(str1).isupper), helpers.filtercount(str2, type(str2).isupper) + alpha1, alpha2 = helpers.filtercount(str1, type(str1).isalpha), helpers.filtercount(str2, type(str2).isalpha) + # Capture the all caps case + if capitals1 == alpha1: + return capitals2 == alpha2 # some heuristic tests to try and see that the style of capitals is vaguely the same if capitals1 == 0 or capitals1 == 1: return capitals2 == capitals1 |
From: Dwayne B. <dwa...@us...> - 2006-06-01 12:55:18
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9296 Modified Files: Tag: wordforge-0-9-branch test_checks.py checks.py Log Message: [Backport] Remove KDE comments before checking for capitals Changed failing simplecaps tests to use the OOo checker as their failing most probably relates to the fact that we do not remove variables when checking for capitals (Removing vars is still TODO). Index: test_checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_checks.py,v retrieving revision 1.72.2.2 retrieving revision 1.72.2.3 diff -u -d -r1.72.2.2 -r1.72.2.3 --- test_checks.py 1 Jun 2006 08:19:53 -0000 1.72.2.2 +++ test_checks.py 1 Jun 2006 12:55:14 -0000 1.72.2.3 @@ -356,10 +356,13 @@ assert checks.passes(stdchecker.simplecaps, "Determine how &brandShortName; connects to the Internet.", "Kuma &brandShortName; hlanganisa eka Internete.") ## If source is ALL CAPS then we should just check that target is also ALL CAPS #assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") + # KDE commens should be removed + assert checks.fails(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") # Just some that at times have failed but should always pass assert checks.passes(stdchecker.simplecaps, "Create a query entering an SQL statement directly.", "Yakha sibuti singena SQL inkhomba yesitatimende.") - assert checks.passes(stdchecker.simplecaps, "SOLK (%PRODUCTNAME Link)", "SOLK (%PRODUCTNAME Thumanyo)") - assert checks.passes(stdchecker.simplecaps, "%STAROFFICE Image", "Tshifanyiso tsha %STAROFFICE") + ooochecker = checks.OpenOfficeChecker() + assert checks.passes(ooochecker.simplecaps, "SOLK (%PRODUCTNAME Link)", "SOLK (%PRODUCTNAME Thumanyo)") + assert checks.passes(ooochecker.simplecaps, "%STAROFFICE Image", "Tshifanyiso tsha %STAROFFICE") # def test_spellcheck(): # """tests simple caps""" Index: checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/checks.py,v retrieving revision 1.89.2.1 retrieving revision 1.89.2.2 diff -u -d -r1.89.2.1 -r1.89.2.2 --- checks.py 1 Jun 2006 10:49:46 -0000 1.89.2.1 +++ checks.py 1 Jun 2006 12:55:14 -0000 1.89.2.2 @@ -562,6 +562,7 @@ def simplecaps(self, str1, str2): """checks the capitalisation of two strings isn't wildly different""" + str1 = prefilters.removekdecomments(str1) capitals1, capitals2 = helpers.filtercount(str1, type(str1).isupper), helpers.filtercount(str2, type(str2).isupper) # some heuristic tests to try and see that the style of capitals is vaguely the same if capitals1 == 0 or capitals1 == 1: |
From: Dwayne B. <dwa...@us...> - 2006-06-01 12:53:13
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8327 Modified Files: test_checks.py checks.py Log Message: Can now handle the allcaps case of simplecaps errors Index: test_checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_checks.py,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- test_checks.py 1 Jun 2006 12:40:42 -0000 1.80 +++ test_checks.py 1 Jun 2006 12:53:05 -0000 1.81 @@ -355,7 +355,7 @@ assert checks.passes(stdchecker.simplecaps, "The element \"%S\" is not recognized.", "Elemente \"%S\" a yi tiveki.") assert checks.passes(stdchecker.simplecaps, "Determine how &brandShortName; connects to the Internet.", "Kuma &brandShortName; hlanganisa eka Internete.") ## If source is ALL CAPS then we should just check that target is also ALL CAPS - #assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") + assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") # KDE commens should be removed assert checks.fails(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") # Just some that at times have failed but should always pass Index: checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/checks.py,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- checks.py 1 Jun 2006 12:40:42 -0000 1.94 +++ checks.py 1 Jun 2006 12:53:05 -0000 1.95 @@ -564,6 +564,10 @@ """checks the capitalisation of two strings isn't wildly different""" str1 = prefilters.removekdecomments(str1) capitals1, capitals2 = helpers.filtercount(str1, type(str1).isupper), helpers.filtercount(str2, type(str2).isupper) + alpha1, alpha2 = helpers.filtercount(str1, type(str1).isalpha), helpers.filtercount(str2, type(str2).isalpha) + # Capture the all caps case + if capitals1 == alpha1: + return capitals2 == alpha2 # some heuristic tests to try and see that the style of capitals is vaguely the same if capitals1 == 0 or capitals1 == 1: return capitals2 == capitals1 |
From: David F. <dav...@us...> - 2006-06-01 12:51:11
|
Update of /cvsroot/translate/src/translate/storage In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7458 Modified Files: po.py test_po.py Log Message: replace escaping/unescaping with system that is actual symmetrical this utilises the new ability of extractwithoutquotes to actually get the escaping via another function fixed tests for msgid comments - they now expect a real newline rather than \\n Index: test_po.py =================================================================== RCS file: /cvsroot/translate/src/translate/storage/test_po.py,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- test_po.py 1 Jun 2006 12:11:49 -0000 1.41 +++ test_po.py 1 Jun 2006 12:51:04 -0000 1.42 @@ -148,8 +148,8 @@ assert len(pofile.units) == 2 print pofile.units[0].msgidcomments print pofile.units[1].msgidcomments - assert po.unquotefrompo(pofile.units[0].msgidcomments) == "_: source1\\n" - assert po.unquotefrompo(pofile.units[1].msgidcomments) == "_: source2\\n" + assert po.unquotefrompo(pofile.units[0].msgidcomments) == "_: source1\n" + assert po.unquotefrompo(pofile.units[1].msgidcomments) == "_: source2\n" def test_keep_blanks(self): """checks that keeping keeps blanks and doesn't add msgid_comments""" Index: po.py =================================================================== RCS file: /cvsroot/translate/src/translate/storage/po.py,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- po.py 1 Jun 2006 08:59:03 -0000 1.132 +++ po.py 1 Jun 2006 12:51:04 -0000 1.133 @@ -34,9 +34,27 @@ # general functions for quoting / unquoting po strings +po_unescape_map = {"\\r": "\r", "\\t": "\t", '\\"': '"', '\\n': '\n', '\\\\': '\\'} +po_escape_map = dict([(value, key) for (key, value) in po_unescape_map.items()]) + def escapeforpo(line): """escapes a line for po format. assumes no \n occurs in the line""" - return line.replace('\\', '\\\\').replace('\n', '\\n').replace('"', '\\"').replace('\t', '\\t').replace('\r', '\\r') + special_locations = [] + for special_key in po_escape_map: + special_locations.extend(quote.find_all(line, special_key)) + special_locations = dict.fromkeys(special_locations).keys() + special_locations.sort() + escaped_line = "" + last_location = 0 + for location in special_locations: + escaped_line += line[last_location:location] + escaped_line += po_escape_map[line[location:location+1]] + last_location = location+1 + escaped_line += line[last_location:] + return escaped_line + +def unescapehandler(escape): + return po_unescape_map.get(escape, escape) def quoteforpo(text, template=None): """quotes the given text for a PO file, returning quoted and escaped lines""" @@ -101,16 +119,9 @@ return polines -def isnewlineescape(escape): - return escape == "\\n" - -def isnewlineortabescape(escape): - return escape == "\\n" or escape == "\\t" or escape == "\\r" - def extractpoline(line): - backslash = '\\' - extracted = quote.extractwithoutquotes(line,'"','"',backslash,includeescapes=isnewlineortabescape)[0] - return extracted # .replace('\\"', '"') + extracted = quote.extractwithoutquotes(line,'"','"','\\',includeescapes=unescapehandler)[0] + return extracted def unquotefrompo(postr, joinwithlinebreak=False): if joinwithlinebreak: @@ -187,7 +198,7 @@ multi = multistring(unquotefrompo(self.msgid), self.encoding) if self.hasplural(): multi.strings.append(unquotefrompo(self.msgid_plural)) - return multi.replace("\\n", "\n").replace("\\t", "\t").replace("\\r", "\r") + return multi def setsource(self, source): """Sets the msgstr to the given (unescaped) value""" |
From: Dwayne B. <dwa...@us...> - 2006-06-01 12:40:49
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1986 Modified Files: test_checks.py checks.py Log Message: REmove KDE comments before checking for capitals Changed failing simplecaps tests to use the OOo checker as their failing most probably relates to the fact that we do not remove variables when checking for capitals (Removing vars is still TODO). Index: test_checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_checks.py,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- test_checks.py 15 May 2006 15:08:07 -0000 1.79 +++ test_checks.py 1 Jun 2006 12:40:42 -0000 1.80 @@ -356,10 +356,13 @@ assert checks.passes(stdchecker.simplecaps, "Determine how &brandShortName; connects to the Internet.", "Kuma &brandShortName; hlanganisa eka Internete.") ## If source is ALL CAPS then we should just check that target is also ALL CAPS #assert checks.passes(stdchecker.simplecaps, "COUPDAYS", "COUPMALANGA") + # KDE commens should be removed + assert checks.fails(stdchecker.simplecaps, "_: KDE COMMENTS\\n\nA string", "Dimpled ring") # Just some that at times have failed but should always pass assert checks.passes(stdchecker.simplecaps, "Create a query entering an SQL statement directly.", "Yakha sibuti singena SQL inkhomba yesitatimende.") - assert checks.passes(stdchecker.simplecaps, "SOLK (%PRODUCTNAME Link)", "SOLK (%PRODUCTNAME Thumanyo)") - assert checks.passes(stdchecker.simplecaps, "%STAROFFICE Image", "Tshifanyiso tsha %STAROFFICE") + ooochecker = checks.OpenOfficeChecker() + assert checks.passes(ooochecker.simplecaps, "SOLK (%PRODUCTNAME Link)", "SOLK (%PRODUCTNAME Thumanyo)") + assert checks.passes(ooochecker.simplecaps, "%STAROFFICE Image", "Tshifanyiso tsha %STAROFFICE") # def test_spellcheck(): # """tests simple caps""" Index: checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/checks.py,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- checks.py 4 May 2006 21:31:14 -0000 1.93 +++ checks.py 1 Jun 2006 12:40:42 -0000 1.94 @@ -562,6 +562,7 @@ def simplecaps(self, str1, str2): """checks the capitalisation of two strings isn't wildly different""" + str1 = prefilters.removekdecomments(str1) capitals1, capitals2 = helpers.filtercount(str1, type(str1).isupper), helpers.filtercount(str2, type(str2).isupper) # some heuristic tests to try and see that the style of capitals is vaguely the same if capitals1 == 0 or capitals1 == 1: |
From: David F. <dav...@us...> - 2006-06-01 12:37:19
|
Update of /cvsroot/translate/src/translate/misc In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1092 Modified Files: quote.py test_quote.py Log Message: change includeescapes to return the actual escaped/unescaped value rather than simply whether to escape it or not (this probably requires an argument name change, and better explanation - see change to isnewlineortabescape in test) the old method of returning a boolean is still supported, but deprecated and needs removing once fixed elsewhere this gives more flexibility in handling escaping warn when invalid named unicode escapes are encountered, rather than raising an error Index: test_quote.py =================================================================== RCS file: /cvsroot/translate/src/translate/misc/test_quote.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- test_quote.py 23 May 2006 10:46:42 -0000 1.10 +++ test_quote.py 1 Jun 2006 12:36:48 -0000 1.11 @@ -43,7 +43,9 @@ assert quote.extractwithoutquotes("<quoted\\>", "<", ">", "\\", 0, False) == ("quoted>", True) def isnewlineortabescape(escape): - return escape == "\\n" or escape == "\\t" + if escape == "\\n" or escape == "\\t": + return escape + return escape[-1] def test_extractwithoutquotes_passfunc(): """tests the extractwithoutquotes function with a function for includeescapes as a parameter""" Index: quote.py =================================================================== RCS file: /cvsroot/translate/src/translate/misc/quote.py,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- quote.py 23 May 2006 11:45:23 -0000 1.37 +++ quote.py 1 Jun 2006 12:36:48 -0000 1.38 @@ -21,6 +21,8 @@ """string processing utilities for extracting strings with various kinds of delimiters""" +import logging + def find_all(searchin, substr): """returns a list of locations where substr occurs in searchin locations are not allowed to overlap""" @@ -104,7 +106,7 @@ def extractwithoutquotes(source,startdelim,enddelim,escape,startinstring=0,includeescapes=1): """Extracts a doublequote-delimited string from a string, allowing for backslash-escaping - includeescapes can also be a function that takes the whole escaped string and returns whether to escape it""" + includeescapes can also be a function that takes the whole escaped string and returns the replaced version""" instring = startinstring lenstart = len(startdelim) lenend = len(enddelim) @@ -148,8 +150,16 @@ last_epos = 0 for epos in escape_list: new_section += section[last_epos:epos] - if callable_includeescapes and includeescapes(section[epos:epos+lenescape+1]): - last_epos = epos + if callable_includeescapes: + replace_escape = includeescapes(section[epos:epos+lenescape+1]) + # TODO: deprecate old method of returning boolean from includeescape, by removing this if block + if not isinstance(replace_escape, basestring): + if replace_escape: + replace_escape = section[epos:epos+lenescape+1] + else: + replace_escape = section[epos+lenescape:epos+lenescape+1] + new_section += replace_escape + last_epos = epos + lenescape + 1 else: last_epos = epos + lenescape section = new_section + section[last_epos:] @@ -275,11 +285,15 @@ output += unichr2(x) elif c == "N": if source[s] != "{": - raise ValueError("Invalid named unicode escape") + logging.warn("Invalid named unicode escape: no { after \\N") + output += "\\" + c + continue s += 1 e = source.find("}", s) if e == -1: - raise ValueError("Invalid named unicode escape") + logging.warn("Invalid named unicode escape: no } after \\N{") + output += "\\" + c + continue import unicodedata name = source[s:e] output += unicodedata.lookup(name) |
From: David F. <dav...@us...> - 2006-06-01 12:12:08
|
Update of /cvsroot/translate/src/translate/storage In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23030 Modified Files: test_po.py Log Message: added test that quoteforpo and unquotefrompo round string strings properly (strings same as in test_base.py) Index: test_po.py =================================================================== RCS file: /cvsroot/translate/src/translate/storage/test_po.py,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- test_po.py 30 May 2006 13:37:18 -0000 1.40 +++ test_po.py 1 Jun 2006 12:11:49 -0000 1.41 @@ -6,6 +6,18 @@ from translate.misc.multistring import multistring from translate.misc import wStringIO +def test_roundtrip_quoting(): + specials = ['Fish & chips', 'five < six', 'six > five', + 'Use ', 'Use &nbsp;' + 'A "solution"', "skop 'n bal", '"""', "'''", + '\n', '\t', '\r', + '\\n', '\\t', '\\r', '\\"', '\r\n', '\\r\\n', '\\'] + for special in specials: + quoted_special = po.quoteforpo(special) + unquoted_special = po.unquotefrompo(quoted_special) + print "special: %r\nquoted: %r\nunquoted: %r\n" % (special, quoted_special, unquoted_special) + assert special == unquoted_special + class TestPOUnit(test_base.TestTranslationUnit): UnitClass = po.pounit |
From: F W. <fri...@us...> - 2006-06-01 11:55:01
|
Update of /cvsroot/translate/src/translate/storage In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16288 Modified Files: test_base.py Log Message: Test string roundtripping Index: test_base.py =================================================================== RCS file: /cvsroot/translate/src/translate/storage/test_base.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- test_base.py 24 Apr 2006 14:37:05 -0000 1.10 +++ test_base.py 1 Jun 2006 11:54:46 -0000 1.11 @@ -65,6 +65,25 @@ unit.settarget("") assert unit.target == "" + def test_escapes(self): + """Test all sorts of characters that might go wrong in a quoting and + escaping roundtrip.""" + unit = self.UnitClass('bla') + specials = ['Fish & chips', 'five < six', 'six > five', + 'Use ', 'Use &nbsp;' + 'A "solution"', "skop 'n bal", '"""', "'''", + '\n', '\t', '\r', + '\\n', '\\t', '\\r', '\\"', '\r\n', '\\r\\n', '\\'] + for special in specials: + unit.source = special + print "unit.source:" + print repr(unit.source) + print unit.source + print "special:" + print repr(special) + print special + assert unit.source == special + class TestTranslationStore: """Tests a TranslationStore. Derived classes can reuse these tests by pointing StoreClass to a derived Store""" |
From: David F. <dav...@us...> - 2006-06-01 11:49:55
|
Update of /cvsroot/translate/src/Pootle In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14471 Modified Files: Tag: wordforge-0-9-branch pootle.py Log Message: disable logging every internal url load which outputs loads of stuff... Index: pootle.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/pootle.py,v retrieving revision 1.29.2.1 retrieving revision 1.29.2.2 diff -u -d -r1.29.2.1 -r1.29.2.2 --- pootle.py 1 Jun 2006 09:18:32 -0000 1.29.2.1 +++ pootle.py 1 Jun 2006 11:49:52 -0000 1.29.2.2 @@ -37,7 +37,7 @@ def loadurl(self, filename, context): """loads a url internally for overlay code""" - print "call to load %s with context:\n%s" % (filename, pprint.pformat(context)) + # print "call to load %s with context:\n%s" % (filename, pprint.pformat(context)) filename = os.path.join(self.templatedir, filename+os.extsep+"html") if os.path.exists(filename): return open(filename, "r").read() |
From: Dwayne B. <dwa...@us...> - 2006-06-01 11:07:50
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30084 Modified Files: Tag: wordforge-0-9-branch test_decoration.py decoration.py Log Message: [Backport] Allow fullstops inside a variables eg &pluginWizard.label; Index: test_decoration.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_decoration.py,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -d -r1.1 -r1.1.2.1 --- test_decoration.py 2 Mar 2006 09:29:14 -0000 1.1 +++ test_decoration.py 1 Jun 2006 11:07:45 -0000 1.1.2.1 @@ -5,6 +5,8 @@ from translate.filters import decoration def test_find_marked_variables(): + """check that we cna identify variables correctly, first value is start location, i + second is avtual variable sans decoations""" vars = decoration.findmarkedvariables("The <variable> string", "<", ">") assert vars == [(4, "variable")] vars = decoration.findmarkedvariables("The $variable string", "$", 1) @@ -13,4 +15,8 @@ assert vars == [(4, "variable")] vars = decoration.findmarkedvariables("The $variable string", "$", 0) assert vars == [(4, "")] + vars = decoration.findmarkedvariables("The &variable; string", "&", ";") + assert vars == [(4, "variable")] + vars = decoration.findmarkedvariables("The &variable.variable; string", "&", ";") + assert vars == [(4, "variable.variable")] Index: decoration.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/decoration.py,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -u -d -r1.13.2.1 -r1.13.2.2 --- decoration.py 1 Jun 2006 10:49:46 -0000 1.13.2.1 +++ decoration.py 1 Jun 2006 11:07:45 -0000 1.13.2.2 @@ -139,7 +139,7 @@ variable = str1[currentpos:endmatch] currentpos = endmatch + len(endmarker) if variable is not None and variable not in ignorelist: - if not variable or variable.replace("_","").isalnum(): + if not variable or variable.replace("_","").replace(".","").isalnum(): variables.append((startmatch, variable)) return variables |
From: Dwayne B. <dwa...@us...> - 2006-06-01 11:06:24
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29366 Modified Files: test_decoration.py decoration.py Log Message: Allow fullstops inside a variables eg $pluginWizard.label; Index: test_decoration.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_decoration.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test_decoration.py 2 Mar 2006 09:29:14 -0000 1.1 +++ test_decoration.py 1 Jun 2006 11:06:19 -0000 1.2 @@ -5,6 +5,8 @@ from translate.filters import decoration def test_find_marked_variables(): + """check that we cna identify variables correctly, first value is start location, i + second is avtual variable sans decoations""" vars = decoration.findmarkedvariables("The <variable> string", "<", ">") assert vars == [(4, "variable")] vars = decoration.findmarkedvariables("The $variable string", "$", 1) @@ -13,4 +15,8 @@ assert vars == [(4, "variable")] vars = decoration.findmarkedvariables("The $variable string", "$", 0) assert vars == [(4, "")] + vars = decoration.findmarkedvariables("The &variable; string", "&", ";") + assert vars == [(4, "variable")] + vars = decoration.findmarkedvariables("The &variable.variable; string", "&", ";") + assert vars == [(4, "variable.variable")] Index: decoration.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/decoration.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- decoration.py 4 May 2006 21:31:14 -0000 1.14 +++ decoration.py 1 Jun 2006 11:06:19 -0000 1.15 @@ -139,7 +139,7 @@ variable = str1[currentpos:endmatch] currentpos = endmatch + len(endmarker) if variable is not None and variable not in ignorelist: - if not variable or variable.replace("_","").isalnum(): + if not variable or variable.replace("_","").replace(".","").isalnum(): variables.append((startmatch, variable)) return variables |
From: Dwayne B. <dwa...@us...> - 2006-06-01 10:49:50
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23687 Modified Files: Tag: wordforge-0-9-branch checks.py decoration.py pofilter.py prefilters.py Log Message: [Backport] all filter related changes from HEAD. Index: prefilters.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/prefilters.py,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -d -r1.16 -r1.16.2.1 --- prefilters.py 23 Mar 2006 10:22:51 -0000 1.16 +++ prefilters.py 1 Jun 2006 10:49:46 -0000 1.16.2.1 @@ -21,7 +21,8 @@ """this is a set of string filters that should be run before the results are analysed...""" -from translate.misc import sparse +from translate.misc import quote +import sre from translate.filters import helpers from translate.filters import decoration @@ -54,7 +55,7 @@ else: accelmarkerlen = len(accelmarker) def filtermarkedaccelerators(str1): """modifies the accelerators in str1 marked with a given marker, using a given filter""" - acclocs = decoration.findaccelerators(str1, accelmarker, ignoreaccelerators) + acclocs, badlocs = decoration.findaccelerators(str1, accelmarker, ignoreaccelerators) fstr1, pos = "", 0 for accelstart, accelerator in acclocs: fstr1 += str1[pos:accelstart] @@ -105,29 +106,33 @@ def filterwordswithpunctuation(str1): """goes through a list of known words that have punctuation and removes the punctuation from them""" - parser = sparse.SimpleParser() - parser.defaulttokenlist.extend(['\\n', '\\"']) - parser.quotechars = () - words = parser.tokenize(str1, [parser.removewhitespace, parser.separatetokens]) + occurrences = [] + for word, replacement in wordswithpunctuation.iteritems(): + occurrences.extend([(pos, word, replacement) for pos in quote.find_all(str1, word)]) + for match in sre.finditer("\w+'\w+", str1, sre.UNICODE): + word = match.group() + if isinstance(word, unicode): + replacement = filter(unicode.isalnum, word) + else: + replacement = filter(str.isalnum, word) + occurrences.append((match.start(), word, replacement)) + occurrences.sort() replacements = [] - for n in range(len(words)-1): - testword = words[n] - if len(testword) > 1: - # remove any ' in the middle of a word... - removeapostrophe = testword[:1] + testword[1:-1].replace("'","") + testword[-1:] - if removeapostrophe != testword: - replacements.append((parser.findtokenpos(n), testword, removeapostrophe)) - continue - npword = wordswithpunctuation.get(testword.lower(), None) - if npword is not None: - replacements.append((parser.findtokenpos(n), testword, npword)) - newstr1 = "" - lastpos = 0 - for pos, origword, newword in replacements: - newstr1 += str1[lastpos:pos] - newstr1 += newword - lastpos = pos + len(origword) - newstr1 += str1[lastpos:] - return newstr1 + for pos, word, replacement in occurrences: + previouschar = (pos == 0) and " " or str1[pos-1] + nextchar = (pos+len(word) == len(str1)) and " " or str1[pos+len(word)] + if (previouschar.isspace() or previouschar == '"') and (nextchar.isspace() or nextchar == '"'): + replacements.append((pos, word, replacement)) + if replacements: + lastpos = 0 + newstr1 = "" + for pos, word, replacement in replacements: + newstr1 += str1[lastpos:pos] + newstr1 += replacement + lastpos = pos + len(word) + newstr1 += str1[lastpos:] + return newstr1 + else: + return str1 Index: pofilter.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/pofilter.py,v retrieving revision 1.24 retrieving revision 1.24.2.1 diff -u -d -r1.24 -r1.24.2.1 --- pofilter.py 16 Feb 2006 09:10:34 -0000 1.24 +++ pofilter.py 1 Jun 2006 10:49:46 -0000 1.24.2.1 @@ -101,24 +101,18 @@ if thepo.isheader(): return [] if not self.options.includefuzzy and thepo.isfuzzy(): return [] if not self.options.includereview and thepo.isreview(): return [] + source = thepo.source + target = thepo.target if thepo.hasplural(): - unquotedid = po.unquotefrompo(thepo.msgid, joinwithlinebreak=False) - unquotedstr = po.unquotefrompo(thepo.msgstr[0], joinwithlinebreak=False) - failures = self.checker.run_filters(thepo, unquotedid, unquotedstr) - unquotedid = po.unquotefrompo(thepo.msgid_plural, joinwithlinebreak=False) - unquotedstr = po.unquotefrompo(thepo.msgstr[1], joinwithlinebreak=False) - failures += self.checker.run_filters(thepo, unquotedid, unquotedstr) + failures = self.checker.run_filters(thepo, source, target) + failures += self.checker.run_filters(thepo, source.strings[1], target.strings[1]) else: - unquotedid = po.unquotefrompo(thepo.msgid, joinwithlinebreak=False) - unquotedstr = po.unquotefrompo(thepo.msgstr, joinwithlinebreak=False) - failures = self.checker.run_filters(thepo, unquotedid, unquotedstr) + failures = self.checker.run_filters(thepo, source, target) if failures and self.options.autocorrect: # we can't get away with bad unquoting / requoting if we're going to change the result... - unquotedid = po.unquotefrompo(thepo.msgid) - unquotedstr = po.unquotefrompo(thepo.msgstr) - correction = autocorrect.correct(unquotedid, unquotedstr) + correction = autocorrect.correct(source, target) if correction: - thepo.msgstr = po.quoteforpo(correction) + thepo.target = correction return autocorrect else: # ignore failures we can't correct when in autocorrect mode Index: decoration.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/decoration.py,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -d -r1.13 -r1.13.2.1 --- decoration.py 2 Mar 2006 09:29:14 -0000 1.13 +++ decoration.py 1 Jun 2006 10:49:46 -0000 1.13.2.1 @@ -81,6 +81,7 @@ def findaccelerators(str1, accelmarker, ignorelist=[]): """returns all the accelerators and locations in str1 marked with a given marker""" accelerators = [] + badaccelerators = [] currentpos = 0 while currentpos >= 0: currentpos = str1.find(accelmarker, currentpos) @@ -94,7 +95,9 @@ currentpos = accelend if isvalidaccelerator(accelerator, ignorelist): accelerators.append((accelstart, accelerator)) - return accelerators + else: + badaccelerators.append((accelstart, accelerator)) + return accelerators, badaccelerators def findmarkedvariables(str1, startmarker, endmarker, ignorelist=[]): """returns all the variables and locations in str1 marked with a given marker""" @@ -144,9 +147,10 @@ """returns a function that gets a list of accelerators marked using accelmarker""" def getmarkedaccelerators(str1): """returns all the accelerators in str1 marked with a given marker""" - acclocs = findaccelerators(str1, accelmarker, ignorelist) + acclocs, badlocs = findaccelerators(str1, accelmarker, ignorelist) accelerators = [accelerator for accelstart, accelerator in acclocs] - return accelerators + badaccelerators = [accelerator for accelstart, accelerator in badlocs] + return accelerators, badaccelerators return getmarkedaccelerators def getvariables(startmarker, endmarker): @@ -217,8 +221,8 @@ """returns a function that counts the number of accelerators marked with the given marker""" def countmarkedaccelerators(str1): """returns all the variables in str1 marked with a given marker""" - acclocs = findaccelerators(str1, accelmarker, ignorelist) - return len(acclocs) + acclocs, badlocs = findaccelerators(str1, accelmarker, ignorelist) + return len(acclocs), len(badlocs) return countmarkedaccelerators Index: checks.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/checks.py,v retrieving revision 1.89 retrieving revision 1.89.2.1 diff -u -d -r1.89 -r1.89.2.1 --- checks.py 11 Apr 2006 09:49:02 -0000 1.89 +++ checks.py 1 Jun 2006 10:49:46 -0000 1.89.2.1 @@ -360,8 +360,8 @@ def singlequoting(self, str1, str2): """checks whether singlequoting is consistent between the two strings""" - str1 = self.filteraccelerators(self.filtervariables(self.filterwordswithpunctuation(prefilters.removekdecomments(str1)))) - str2 = self.filteraccelerators(self.filtervariables(self.filterwordswithpunctuation(str2))) + str1 = self.filterwordswithpunctuation(self.filteraccelerators(self.filtervariables(prefilters.removekdecomments(str1)))) + str2 = self.filterwordswithpunctuation(self.filteraccelerators(self.filtervariables(str2))) return helpers.countsmatch(str1, str2, ("'", "''", "\\'")) def doublequoting(self, str1, str2): @@ -399,12 +399,17 @@ messages = [] for accelmarker in self.config.accelmarkers: counter = decoration.countaccelerators(accelmarker) - count1 = counter(str1) - count2 = counter(str2) + count1, countbad1 = counter(str1) + count2, countbad2 = counter(str2) + getaccel = decoration.getaccelerators(accelmarker) + accel2, bad2 = getaccel(str2) if count1 == count2: continue if count1 == 1 and count2 == 0: - messages.append("accelerator %s is missing from translation" % accelmarker) + if countbad2 == 1: + messages.append("accelerator %s appears before an invalid accelerator character '%s' (eg. space)" % (accelmarker, bad2[0])) + else: + messages.append("accelerator %s is missing from translation" % accelmarker) elif count1 == 0: messages.append("accelerator %s does not occur in original and should not be in translation" % accelmarker) elif count1 == 1 and count2 > count1: @@ -715,6 +720,7 @@ raise FilterFailure(messages) return True + # If the precondition filter is run and fails then the other tests listed are ignored preconditions = {"untranslated": ("simplecaps", "variables", "startcaps", "accelerators", "brackets", "endpunc", "acronyms", "xmltags", "startpunc", @@ -722,7 +728,9 @@ "escapes", "doublequoting", "singlequoting", "filepaths", "purepunc", "doublespacing", "sentencecount", "numbers", "isfuzzy", - "isreview", "notranslatewords", "musttranslatewords"), + "isreview", "notranslatewords", "musttranslatewords", + "emails", "simpleplurals", "urls"), + "unchanged": ("doublewords",), "compendiumconflicts": ("accelerators", "brackets", "escapes", "numbers", "startpunc", "long", "variables", "startcaps", "sentencecount", "simplecaps", |
From: F W. <fri...@us...> - 2006-06-01 10:38:17
|
Update of /cvsroot/translate/src/translate/convert In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv20009/translate/convert Modified Files: Tag: wordforge-0-9-branch test_prop2po.py Log Message: Fix test to test for real newlines Index: test_prop2po.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/test_prop2po.py,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -d -r1.13 -r1.13.2.1 --- test_prop2po.py 11 Apr 2006 11:59:35 -0000 1.13 +++ test_prop2po.py 1 Jun 2006 10:38:08 -0000 1.13.2.1 @@ -168,7 +168,7 @@ propsource = '''prop=\\nvalue\\n\n''' pofile = self.prop2po(propsource) unit = self.singleelement(pofile) - assert unit.source == "\\nvalue\\n\n" + assert unit.source == "\nvalue\n" class TestProp2POCommand(test_convert.TestConvertCommand, TestProp2PO): """Tests running actual prop2po commands on files""" |
From: David F. <dav...@us...> - 2006-06-01 10:33:35
|
Update of /cvsroot/translate/src/Pootle In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18330 Modified Files: Tag: wordforge-0-9-branch pootlefile.py projects.py test_pootlefile.py Log Message: renamed getids to getlocations to fit with HEAD and now-changes translate toolkit 0.9 branch Index: pootlefile.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/pootlefile.py,v retrieving revision 1.35 retrieving revision 1.35.2.1 diff -u -d -r1.35 -r1.35.2.1 --- pootlefile.py 5 Apr 2006 07:49:24 -0000 1.35 +++ pootlefile.py 1 Jun 2006 10:33:31 -0000 1.35.2.1 @@ -447,9 +447,9 @@ suggitems = [] suggids = {} for thesugg in self.pendingfile.units: - ids = tuple(thesugg.getids()) + ids = tuple(thesugg.getlocations()) suggids[ids] = thesugg - suggitems = [item for item in self.transelements if tuple(item.getids()) in suggids] + suggitems = [item for item in self.transelements if tuple(item.getlocations()) in suggids] havesuggestions = self.classify["has-suggestion"] for item, poel in enumerate(self.transelements): if (poel in suggitems) != (item in havesuggestions): @@ -465,9 +465,9 @@ """find all the suggestion items submitted for the given (pofile or pofilename) and item""" self.readpendingfile() thepo = self.transelements[item] - ids = thepo.getids() + ids = thepo.getlocations() # TODO: review the matching method - suggestpos = [suggestpo for suggestpo in self.pendingfile.units if suggestpo.getids() == ids] + suggestpos = [suggestpo for suggestpo in self.pendingfile.units if suggestpo.getlocations() == ids] return suggestpos def addsuggestion(self, item, suggmsgstr, username): @@ -487,9 +487,9 @@ """removes the suggestion from the pending file""" self.readpendingfile() thepo = self.transelements[item] - ids = thepo.getids() + ids = thepo.getlocations() # TODO: remove the suggestion in a less brutal manner - pendingitems = [pendingitem for pendingitem, suggestpo in enumerate(self.pendingfile.units) if suggestpo.getids() == ids] + pendingitems = [pendingitem for pendingitem, suggestpo in enumerate(self.pendingfile.units) if suggestpo.getlocations() == ids] pendingitem = pendingitems[suggitem] del self.pendingfile.units[pendingitem] self.savependingfile() @@ -572,7 +572,7 @@ continue foundid = False if useids: - newids = newpo.getids() + newids = newpo.getlocations() mergedids = [] for id in newids: if id in mergedids: Index: projects.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/projects.py,v retrieving revision 1.60.2.2 retrieving revision 1.60.2.3 diff -u -d -r1.60.2.2 -r1.60.2.3 --- projects.py 25 May 2006 06:34:14 -0000 1.60.2.2 +++ projects.py 1 Jun 2006 10:33:31 -0000 1.60.2.3 @@ -457,7 +457,7 @@ continue foundsource = False if usesources: - for source in origpo.getids(): + for source in origpo.getlocations(): if source in newpofile.sourceindex: newpo = newpofile.sourceindex[source] if newpo is not None: Index: test_pootlefile.py =================================================================== RCS file: /cvsroot/translate/src/Pootle/test_pootlefile.py,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -u -d -r1.4 -r1.4.4.1 --- test_pootlefile.py 13 Mar 2006 09:25:56 -0000 1.4 +++ test_pootlefile.py 1 Jun 2006 10:33:31 -0000 1.4.4.1 @@ -127,7 +127,7 @@ pofile = self.poparse(posource) assert len(pofile.units) == 1 thepo = pofile.units[0] - assert thepo.getids() == ["test.c"] + assert thepo.getlocations() == ["test.c"] assert thepo.source == "test" assert thepo.target == "rest" |
From: David F. <dav...@us...> - 2006-06-01 10:29:44
|
Update of /cvsroot/translate/src/translate/storage In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16778/storage Modified Files: Tag: wordforge-0-9-branch po.py test_po.py Log Message: renamed getids to getlocations to align with HEAD (not a full backport as not renaming internal objects or putting this on base class yet) Index: test_po.py =================================================================== RCS file: /cvsroot/translate/src/translate/storage/test_po.py,v retrieving revision 1.34 retrieving revision 1.34.2.1 diff -u -d -r1.34 -r1.34.2.1 --- test_po.py 5 Apr 2006 09:28:53 -0000 1.34 +++ test_po.py 1 Jun 2006 10:29:37 -0000 1.34.2.1 @@ -66,7 +66,7 @@ pofile = self.poparse(posource) assert len(pofile.units) == 1 thepo = pofile.units[0] - assert thepo.getids() == ["test.c"] + assert thepo.getlocations() == ["test.c"] assert thepo.source == "test" assert thepo.target == "rest" @@ -87,7 +87,7 @@ assert len(pofile.units) == 2 pofile.removeduplicates("merge") assert len(pofile.units) == 1 - assert pofile.units[0].getids() == ["source1", "source2"] + assert pofile.units[0].getlocations() == ["source1", "source2"] def test_merge_mixed_sources(self): """checks that merging works with different source location styles""" @@ -107,7 +107,7 @@ pofile.removeduplicates("merge") print str(pofile) assert len(pofile.units) == 1 - assert pofile.units[0].getids() == ["source1", "source2"] + assert pofile.units[0].getlocations() == ["source1", "source2"] def test_merge_blanks(self): """checks that merging adds msgid_comments to blanks""" Index: po.py =================================================================== RCS file: /cvsroot/translate/src/translate/storage/po.py,v retrieving revision 1.110.2.2 retrieving revision 1.110.2.3 diff -u -d -r1.110.2.2 -r1.110.2.3 --- po.py 1 Jun 2006 09:12:02 -0000 1.110.2.2 +++ po.py 1 Jun 2006 10:29:37 -0000 1.110.2.3 @@ -464,7 +464,7 @@ postr = "".join(lines) return postr - def getids(self): + def getlocations(self): """returns the list of sources from sourcecomments in the po element""" sources = [] for sourcecomment in self.sourcecomments: @@ -753,7 +753,7 @@ # TODO: this is using a list as the pos aren't hashable, but this is slow... markedpos = [] def addcomment(thepo): - thepo.msgidcomments.append('"_: %s\\n"' % " ".join(thepo.getids())) + thepo.msgidcomments.append('"_: %s\\n"' % " ".join(thepo.getlocations())) markedpos.append(thepo) for thepo in self.units: if duplicatestyle.startswith("msgid_comment"): @@ -798,7 +798,7 @@ if thepo.hasplural(): msgid_plural = unquotefrompo(thepo.msgid_plural) self.msgidindex[msgid_plural] = thepo - for source in thepo.getids(): + for source in thepo.getlocations(): if source in self.sourceindex: # if sources aren't unique, don't use them self.sourceindex[source] = None |
From: David F. <dav...@us...> - 2006-06-01 10:29:44
|
Update of /cvsroot/translate/src/translate/convert In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16778/convert Modified Files: Tag: wordforge-0-9-branch dtd2po.py po2dtd.py po2nb.py po2oo.py po2ts.py po2xliff.py pot2po.py Log Message: renamed getids to getlocations to align with HEAD (not a full backport as not renaming internal objects or putting this on base class yet) Index: pot2po.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/pot2po.py,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -d -r1.12 -r1.12.2.1 --- pot2po.py 23 Mar 2006 06:24:33 -0000 1.12 +++ pot2po.py 1 Jun 2006 10:29:36 -0000 1.12.2.1 @@ -78,11 +78,11 @@ if not thepo.isheader(): if templatefile: possiblematches = [] - for source in thepo.getids(): + for source in thepo.getlocations(): otherpo = templatepo.sourceindex.get(source, None) if otherpo is not None: possiblematches.append(otherpo) - if len(thepo.getids()) == 0: + if len(thepo.getlocations()) == 0: otherpo = templatepo.findunit(thepo.source) if otherpo: possiblematches.append(otherpo) Index: po2nb.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/po2nb.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -d -r1.7 -r1.7.2.1 --- po2nb.py 13 Mar 2006 09:31:02 -0000 1.7 +++ po2nb.py 1 Jun 2006 10:29:36 -0000 1.7.2.1 @@ -57,7 +57,7 @@ for thepo in inputpo.units: if thepo.isheader(): continue - for source in thepo.getids(): + for source in thepo.getlocations(): filename, fieldname = source.split("#", 1) fieldvalue = self.convertmessage(thepo.msgstr) if not fieldvalue.strip(): Index: dtd2po.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/dtd2po.py,v retrieving revision 1.57.2.1 retrieving revision 1.57.2.2 diff -u -d -r1.57.2.1 -r1.57.2.2 --- dtd2po.py 1 Jun 2006 08:49:01 -0000 1.57.2.1 +++ dtd2po.py 1 Jun 2006 10:29:36 -0000 1.57.2.2 @@ -123,7 +123,7 @@ # do a standard translation self.convertcomments(thedtd,thepo) self.convertstrings(thedtd,thepo) - if thepo.isblank() and not thepo.getids(): + if thepo.isblank() and not thepo.getlocations(): return None else: return thepo Index: po2xliff.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/po2xliff.py,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -d -r1.15 -r1.15.2.1 --- po2xliff.py 13 Mar 2006 09:31:02 -0000 1.15 +++ po2xliff.py 1 Jun 2006 10:29:36 -0000 1.15.2.1 @@ -150,7 +150,7 @@ targetnode.setAttribute("state-qualifier", "fuzzy-match") else: targetnode.setAttribute("state", "translated") - for sourcelocation in thepo.getids(): + for sourcelocation in thepo.getlocations(): transunitnode.appendChild(self.createcontextgroup(sourcelocation)) return transunitnode else: Index: po2ts.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/po2ts.py,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -d -r1.13 -r1.13.2.1 --- po2ts.py 13 Mar 2006 09:31:02 -0000 1.13 +++ po2ts.py 1 Jun 2006 10:29:36 -0000 1.13.2.1 @@ -55,7 +55,7 @@ source = source.decode("utf-8") if isinstance(translation, str): translation = translation.decode("utf-8") - for sourcelocation in thepo.getids(): + for sourcelocation in thepo.getlocations(): if "#" in sourcelocation: contextname = sourcelocation[:sourcelocation.find("#")] else: Index: po2oo.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/po2oo.py,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -u -d -r1.36 -r1.36.2.1 --- po2oo.py 11 Apr 2006 14:00:16 -0000 1.36 +++ po2oo.py 1 Jun 2006 10:29:36 -0000 1.36.2.1 @@ -89,7 +89,7 @@ def handlepoelement(self, thepo): # TODO: make this work for multiple columns in oo... - sources = thepo.getids() + sources = thepo.getlocations() # technically our formats should just have one source for each entry... # but we handle multiple ones just to be safe... for source in sources: @@ -176,10 +176,10 @@ if filterresult != autocorrect: for filtername, filtermessage in filterresult: if filtername in self.options.error: - print >> sys.stderr, "Error at %s::%s: %s" % (filename, thepo.getids()[0], filtermessage) + print >> sys.stderr, "Error at %s::%s: %s" % (filename, thepo.getlocations()[0], filtermessage) return not filteraction in ["exclude", "exclude-serious"] if filtername in self.options.warning or self.options.alwayswarn: - print >> sys.stderr, "Warning at %s::%s: %s" % (filename, thepo.getids()[0], filtermessage) + print >> sys.stderr, "Warning at %s::%s: %s" % (filename, thepo.getlocations()[0], filtermessage) return not filteraction in ["exclude"] return True Index: po2dtd.py =================================================================== RCS file: /cvsroot/translate/src/translate/convert/po2dtd.py,v retrieving revision 1.38 retrieving revision 1.38.2.1 diff -u -d -r1.38 -r1.38.2.1 --- po2dtd.py 13 Mar 2006 09:31:01 -0000 1.38 +++ po2dtd.py 1 Jun 2006 10:29:36 -0000 1.38.2.1 @@ -170,7 +170,7 @@ return self.dtdfile def handlepoelement(self, thepo): - entities = thepo.getids() + entities = thepo.getlocations() mixedentities = getmixedentities(entities) for entity in entities: if self.dtdfile.index.has_key(entity): |
From: Dwayne B. <dwa...@us...> - 2006-06-01 10:23:13
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv14275 Modified Files: prefilters.py Log Message: Make the regular expression consider Unicode, so that \w identifies non-ascii letter characters. Index: prefilters.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/prefilters.py,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- prefilters.py 4 May 2006 21:31:14 -0000 1.19 +++ prefilters.py 1 Jun 2006 10:23:08 -0000 1.20 @@ -109,7 +109,7 @@ occurrences = [] for word, replacement in wordswithpunctuation.iteritems(): occurrences.extend([(pos, word, replacement) for pos in quote.find_all(str1, word)]) - for match in sre.finditer("\w+'\w+", str1): + for match in sre.finditer("\w+'\w+", str1, sre.UNICODE): word = match.group() if isinstance(word, unicode): replacement = filter(unicode.isalnum, word) |
From: Dwayne B. <dwa...@us...> - 2006-06-01 09:53:16
|
Update of /cvsroot/translate/src/translate/filters In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv3595 Modified Files: Tag: wordforge-0-9-branch test_pofilter.py Log Message: Mark a string as unicode Index: test_pofilter.py =================================================================== RCS file: /cvsroot/translate/src/translate/filters/test_pofilter.py,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -d -r1.11 -r1.11.2.1 --- test_pofilter.py 17 Mar 2006 13:14:57 -0000 1.11 +++ test_pofilter.py 1 Jun 2006 09:53:13 -0000 1.11.2.1 @@ -112,7 +112,7 @@ def test_unicode(self): """tests that we can handle UTF-8 encoded characters when there is no known header specified encoding""" - posource = '#: test.c\nmsgid "Bézier curve"\nmsgstr "Bézier-kurwe"' + posource = u'#: test.c\nmsgid "Bézier curve"\nmsgstr "Bézier-kurwe"' poresult = self.pofilter(posource) assert poresult == '' |