[PyQt] Internationalisation

Phil Thompson phil at riverbankcomputing.com
Mon Dec 12 17:41:27 GMT 2011


On Mon, 12 Dec 2011 16:50:25 +0000, Jeremy Sanders
<jeremy at jeremysanders.net> wrote:
> Hi - are most people using gettext or Qt for their internationalisation?
> 
> I played with pylupdate, but it doesn't always find the strings. For 
> instance I can't do something like
> 
> def mytr(text):
>   return QApplication.translate("myclass", text)
> 
> class myclass:
>  ....
>  def __init__(self):
>    foo = mytr("hello")
> 
> I wonder whether it is worth making a simple Python-based version of 
> pylupdate. It could use the ast module to get a tree of the python code
to 
> find calls to translation functions. The user could mark their
translation 
> function with something in the docstring for the parser to interpret.

It's been on my TODO list for some time to do exactly that (except I would
pass the names of translation functions as command line arguments).

Phil


More information about the PyQt mailing list