2010/9/28 Peter Landgren <peter.talken@telia.com>
Den Tuesday 28 September 2010 11.28.47 skrev Benny Malengier:
> 2010/9/28 Peter Landgren <peter.talken@telia.com>
>
> > Hi,
> >
> > I'm working on using Gramps on Win with non ascii usernames.
> >
> > This works well now, but there is a strange side effect:
> >
> > The first 138 translation strings, sent to gettext,  goes to a line in
> > ggettext.py:
> > return unicode(pgettext.gettext(msgdid))
>
> This is an entry of encodings into Gramps, so we convert to unicode to be
> sure we work internally in Gramps with unicode strings.
>
> > >From this I assume that the real translation should take place in
> >
> > pgettext.gettext,
> > but that code is never called.
>
> Yes, no matter what, gettext does the translation. The new gettext class
> retrieval of strings returns unicode by default I think, but these basic
> methods not.
>
> > The rest of the translations strings are translated OK.
> >
> > Most of the first 138 strings emanate from programs is src/gen/lib.
> >
> > I can't see how my patches could influence this?
> >
> > Any ideas?
>
> Remember that Josip did a lot of magic for gettext to work properly, by
> searching the correct dll's on windows.
> If you add a print statement, I assume not only the first 138 strings go
> there, but all of them, no?
It's both Linux and Windows problem.
But now I know where it comes from.
I have in TransUtils.py together with other impor statements:
from Utils import get_unicode_path_from_env_var
If I comment out that import and its usage, everything is translated fine now.

If I move the import statement to where the function is used, it also works fine.
So, what shall i do? What's the rule in a case like this?

The order of imports  at startup is very important for the translation system.
You must start with gramps.py, and look at function after function, so that TransUtils.py is imported and domain is set before other imports are dragged in.

That is why we had to put the win() function in a new file too, because const.py could not be imported before TransUtils was done, remember?

Benny

/Peter

> Benny
>
> > /Peter
> >
> >
> > -------------------------------------------------------------------------
> > ----- Start uncovering the many advantages of virtual appliances
> > and start using them to simplify application deployment and
> > accelerate your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Gramps-devel mailing list
> > Gramps-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gramps-devel

--
Peter Landgren
Talken Hagen
671 94  BRUNSKOG
0570-530 21
070-345 0964
peter.talken@telia.com
Skype: pgl4820.2