Checking po files using python

0 views
Skip to first unread message

Christos Trochalakis

unread,
Sep 15, 2009, 2:17:20 PM9/15/09
to Transifex devel list
Recently there was a bug about po file checking during submission.
This code is around spawning a new process that runs msgfmt --check
and parsing the output. Well, this is slow, ugly and makes my eyes
bleed.

Here is a c-extension module that runs those checks using libgettext.
The po.check(filename) function returns a list of dicts like this:

{'column': 0,
'filename': None,
'lineno': 0,
'message': "headerfield `Project-Id-Version' missing in header\n",
'severity': 'error'}

Anyone who wants to help is more than welcome. Right now the code
needs some polishing and we need to create a test suite of corrupted
files for testing.

$ mkvirtualenv pocheck
$ git clone git://github.com/ctrochalakis/python-postats.git
$ cd python-postats
$ git checkout -b check origin/check
$ easy_install .
$ python msgtest.py example.po

-christos

Og Maciel

unread,
Sep 17, 2009, 12:04:11 PM9/17/09
to Transifex devel list
On Tue, 2009-09-15 at 21:17 +0300, Christos Trochalakis wrote:
> Here is a c-extension module that runs those checks using libgettext.
> The po.check(filename) function returns a list of dicts like this:
>
> {'column': 0,
> 'filename': None,
> 'lineno': 0,
> 'message': "headerfield `Project-Id-Version' missing in header\n",
> 'severity': 'error'}

Very interesting!

> Anyone who wants to help is more than welcome. Right now the code
> needs some polishing and we need to create a test suite of corrupted
> files for testing.

Just forked your project. Hopefully I'll find some free time between
projects to contribute a bit.

Cheers,
--
Og B. Maciel

oma...@foresightlinux.org
ogma...@gnome.org
ogma...@ubuntu.com

GPG Keys: D5CFC202

http://www.ogmaciel.com (en_US)
http://blog.ogmaciel.com (pt_BR)

signature.asc
Reply all
Reply to author
Forward
0 new messages