multilanguage application - step by step

Peter Irbizon peterirbizon at gmail.com
Thu Jul 28 06:12:03 EDT 2011


Hello,

thank you for reply.
I tried this:
# -*- coding: utf-8 -*-
import gettext
gettext.bindtextdomain('multilanguage',
'E:\folder')
gettext.textdomain('multilanguage')
_ = gettext.gettext
# ...
lang1 = gettext.translation('multilanguage', languages=['sk'])
lang1.install()
print _('This is a translatable string.')

but ErrNo 2 no translation file found for domain: 'multilanguage'
I am doing something wrong way. I would like to switch languages in my
program 'on the fly' without affecting windows.

P.S. sorry for double posting but when I post my message on googlegroups I
can't see it in googlegroups (don't know why)
thanks
2011/7/28 Chris Rebert <clp2 at rebertia.com>

>  On Thu, Jul 28, 2011 at 2:11 AM, Peter Irbizon <peterirbizon at gmail.com>
> wrote:
> > Hello guys,
> >
> > I would like to translate all strings in my application for several
> > languages (eng, es, de, etc) and user should be able to switch app
> > from one language to another. I am still newbie with python so is
> > there any "step-by-step" tutorial how to to this? thanks for help
>
> Please refrain from double-posting in the future.
>
> The `gettext` module's docs look fairly straightforward:
>
> http://docs.python.org/library/gettext.html#internationalizing-your-programs-and-modules
> See also the "Here’s an example of typical usage for this API:" code
> snippet.
>
> For the translation file workflow, the Wikipedia article seems
> enlightening:
> http://en.wikipedia.org/wiki/GNU_gettext
>
> Cheers,
> Chris
> --
> http://rebertia.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110728/8d0da584/attachment.html>


More information about the Python-list mailing list