[PyQt] Providing .qm files with the exe

Jebagnana Das jebagnanadas at gmail.com
Thu Apr 30 13:34:53 BST 2015


Thanks for replying. We're currently using cx_freeze to freeze our python
scripts into exe and then we use InstallShield for creating windows
installer. We are also making the application compatible for Mac with
Py2App.

It looks like decrypting the data dynamically and use loadFromData seems to
be the only way for this use case. It would be great if anybody can share a
minimal example of using loadFromData.

Thanks,
Jeba


On 30/04/2015 03:51, Jebagnana Das wrote:
> > Dear Team,
> >
> > We are writing a PyQt application with multi language support.
> >
> > *_Option 1:_*
> >
> > We are thinking about providing the language (.qm) files separately
> probably
> > within the installation folder of our application exe due to the
> following reasons
> >
> > 1. If any new feature is added we can release it right away without
> waiting
> > for the translated strings in 20+ languages. Later when the translation
> file
> > arrives the agent can pull the latest file from the server when it
> communicates
> >
> > 2. If any changes or corrections are made in the existing translations
> it can
> > also be instantly applied with the above technique.
> >
> > But the qm files can be editable and the user can play around with it
> and can
> > replace the original translation with some offensive language with the
> intent
> > of damaging the reputation of the product.
>
> Depending on the permissions. Maybe the user has no root rights on the PC.
>
> > *_Option 2:_*
> >
> > I read about another option of converting them as a QtResource file and
> derive
> > a python resource file out of it which will be bundled within the exe
> itself.
> > The cons of this approach are
> >
> > 1. We will be forced to hold the release until all the translated files
> arrive
> > from different translators
> >
> > 2. If any alterations are made in the existing translations, we need to
> update
> > or provide auto-upgrade for the existing exe to reflect the changes
> which will
> > consume more server and agent bandwidth(in MBs) as opposed to updating
> only
> > the translation files(few KBs) and exe upgrdation is cumbersome and
> costlier
> > when we weigh it with all the inherent complexities involved.
> >
> > Any solution for resolving this use-case would be highly appreciated.
>
> First, you're talking about "exe". You mean windows only? You want to use
> pyqtdeploy?
>
> QTranslator has a loadFromData which loads translations from an arbitrary
> string buffer. You can encrypt the .qm files and decrypt them before
> feeding
> the QTranslator(s).
>
> --
>              Giuseppe Corbelli
>


> WASP Software Engineer, Copan Italia S.p.A
> Phone: +390303666318  Fax: +390302659932
> E-mail: giuseppe.corbelli at copanitalia.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150430/b11f39f5/attachment.html>


More information about the PyQt mailing list