Hi everyone, During the italian translation of Mailman I've done many typo errors which, in the worst case, caused Mailman misbehaving. I think the real problem is that I couldn't find any editor or tool which does the following checks: - when translating a text template, if a given %s or %(var)s is in the original file it probably should appear the same number of times in the translated text. - in the translated text you shouldn't have a %(var)s if that %(var)s wasn't in the original text. - when translating an html template, the same concept should apply for <MM-*> tags. - when translating the .po file, the same concept should apply for each msgid/msgstr pair. So, to easy the process, I've written a small script to check my translation whenever I do some update. This script has been generalized and now you can use it for your language too. Just for an overview of how much the tool can be effective, this simple bash script: ----------------------------------------------- for i in big5 cs de es fi fr hu it ja ko no ru; do echo -ne "$i:\t"; transcheck -q $i; done ----------------------------------------------- applied to the last Mailman-CVS has reported: big5: 33 warnings in 9 files cs: 192 warnings in 3 files de: 136 warnings in 6 files es: 115 warnings in 12 files fi: 312 warnings in 6 files fr: 58 warnings in 4 files hu: 105 warnings in 6 files it: 1 warnings in 1 files ja: 182 warnings in 3 files ko: 231 warnings in 8 files no: 30 warnings in 3 files ru: 341 warnings in 13 files Before using my script, the italian translation counted about 70 warnings. The one still counted actually is not an error: a %(var)s appears two times in the original english text but in italian we have intentionally only one. Using the script without the -q switch, you can see a detailed report. The script isn't perferct and can be improved in many ways: - better regexp to search for Python %(var)s - better .po parser - better exception handling for strange situation - generalizations to use it in other python projects but it's already good (at least for italian). Feel free to use it and to report any feedback. Cheers, Simone -- Simone Piunno, FerraraLUG - http://members.ferrara.linux.it/pioppo
"SP" == Simone Piunno <pioppo@ferrara.linux.it> writes:
SP> So, to easy the process, I've written a small script to check SP> my translation whenever I do some update. This script has SP> been generalized and now you can use it for your language too. Very cool! How'd you like to contribute that to FSF? :) SP> The script isn't perferct and can be improved in many ways: | - better regexp to search for Python %(var)s Take a look at Mailman/Utils.py, especially at the bottom of the file. There's some decent extraction functions in there (e.g. percent_identifiers()). | - better .po parser Yup, that would be helpful. pygettext.py has some facilities for this I believe, but it may have better generation support than parsing support. | - better exception handling for strange situation | - generalizations to use it in other python projects Guido and I are really trying to push $name strings for i18n projects. It's a major reason why I wrote PEP 292: http://www.python.org/peps/pep-0292.html and while the PEP is controversial in the general Python community, I think there's a strong push to use these over %(name)s placeholders in translatable strings. E.g. Zope3 I18n is going to adopt them too. After MM2.1 is released, I plan to (hopefully mechanically ;) convert all MM source to use $-strings. Yes, I'll automatically update the catalogs too! :) SP> but it's already good (at least for italian). Excellent. Actually come to think of it, it might be more useful going into the Python distro, perhaps as python/Tools/i18n/checkcatalog.py. It would need a bit more generalization but not much. That way you wouldn't have to contribute it to the FSF and it would get wider use in the Python community. A quick scan of the code looks quite good style-wise for inclusion in the library. The major change I'd make is switching from hard-tab indents to 4-space indents (no tabs). I've done that in my copy and could check that into the Python tree if you like. Either way, I'd love to include this in some project. Thanks! -Barry
SP> So, to easy the process, I've written a small script to check
Very cool! How'd you like to contribute that to FSF? :)
I'd be proud of it!
| - better regexp to search for Python %(var)s
Take a look at Mailman/Utils.py, especially at the bottom of the file. There's some decent extraction functions in there (e.g. percent_identifiers()).
nice, I'll try to reuse it.
Guido and I are really trying to push $name strings for i18n projects. It's a major reason why I wrote PEP 292:
I personally don't like this idea, mainly because I love python for its minimalism and having three interpolation methods is baroque :) Anyway I'll try to support them too.
Yes, I'll automatically update the catalogs too! :)
feewww :)
I'd make is switching from hard-tab indents to 4-space indents (no tabs). I've done that in my copy and could check that into the Python tree if you like. Either way, I'd love to include this in some project.
Yeah! Where do I need to sign? :) -- Simone Piunno, FerraraLUG - http://members.ferrara.linux.it/pioppo
"SP" == Simone Piunno <pioppo@ferrara.linux.it> writes:
>> Guido and I are really trying to push $name strings for i18n >> projects. It's a major reason why I wrote PEP 292: SP> I personally don't like this idea, mainly because I love SP> python for its minimalism and having three interpolation SP> methods is baroque :) Anyway I'll try to support them too. I know, it's controversial. :) Still I've seen way too many problems with %(name)s to be really happy with it. >> Yes, I'll automatically update the catalogs too! :) SP> feewww :) :) >> I'd make is switching from hard-tab indents to 4-space indents >> (no tabs). I've done that in my copy and could check that into >> the Python tree if you like. Either way, I'd love to include >> this in some project. SP> Yeah! Where do I need to sign? :) If you'd like to add it to the Python distro (which after more thinking is probably the right place for it), nothing!... yet. Eventually the PSF will have a contribution form such as proposed here: http://www.python.org/psf/psf-contributor-agreement.html but it's not been approved yet, so we'd just have to remember to do it later <wink>. If you give me the green light, I'll add it to Python 2.3cvs. Then I can copy it into Mailman's bin/ directory "for convenience" <wink>. -Barry
SP> Yeah! Where do I need to sign? :)
If you'd like to add it to the Python distro (which after more thinking is probably the right place for it), nothing!... yet.
probably nothing even in the FSF case, because I've already signed a document long time ago (don't remember if it was for translations only or more general)
Eventually the PSF will have a contribution form such as proposed here: but it's not been approved yet, so we'd just have to remember to do it
ok
If you give me the green light, I'll add it to Python 2.3cvs.
approved :) -- Simone Piunno, FerraraLUG - http://members.ferrara.linux.it/pioppo
barry@zope.com (Barry A. Warsaw) writes:
Excellent. Actually come to think of it, it might be more useful going into the Python distro, perhaps as python/Tools/i18n/checkcatalog.py. It would need a bit more generalization but not much.
Traditionally (atleast for GNU gettext), msgfmt had a "strict" mode, where it finds all kinds of problems. In case msgfmt.py is acceptable for the build process, I think it could be enhanced to perform checks as well. Patches are welcome. Regards, Martin
participants (3)
-
barry@zope.com
-
loewis@informatik.hu-berlin.de
-
Simone Piunno