"SP" == Simone Piunno email@example.com 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:
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.