Hi Sandro,

On Fri, 2007-04-13 at 13:43 +0200, Sandro Dentella wrote:
> > sandro.dentella a écrit :
> > > Thanks! that was it. Now I can reproduce the error. Which is the
> > > "correct" solution?
> > > 
> > > An easy and not really nice one is to encode title into
> > > DEFAULT_CHARSET, but I'd rather
> > > have _() return an unicode object. How should I do to obtain this?
> > 
> > some python conversion exemple can peharps help you :
> > 
> > textutf8=unicode(textascii,'utf-8')
> 
> this cannot be used in my case. Unicode conversion is taking place out of my
> control just becouse the format string is 'promoted' to unicode becouse of
> title being already unicode as spotted by Michael
> 
>    subject = _("Priority changed in ticket #%(id)s %(title)s") % (
>         {'id': 11, 'title': u'abc'}) 
> 
> what I'd like to use if the function ugettext that is documented in gettext
> module, but I can't find it nor in django.util.translation nor in python
> gettext module... ('module' object has no attribute 'ugettext')

Passing pure unicode strings around inside Django at the moment leads to
unpredictable behaviour. It's not expected to work and it doesn't,
sadly. Interactions with gettext() are one of the problematic cases.

Fixing the trunk codebase in small steps turned out to be very hard.
Just before Easter, I spent four days trying to do this, working on
almost nothing except i18n bugs. It was too hard for my tiny brain; I
ended up just pushing the problems around from one subsystem to another
as I tried to fix them. This didn't improve things overall and made the
codebase just look unstable, which wasn't a good idea.

As Michael mentioned, I've decided to bite the bullet and make the
larger internal changes we've talked about previously. This is ongoing
work. I've finished maybe 50% of it and then got busy last week. I'll be
back working on that this week in the time I have for working on Django.
The idea is that the unicode branch will be very short-lived and
finished quickly. All I can suggest is that you wait for that to be
completed shortly. Rewriting some of the gettext handling is part of
that conversion process (and not done yet -- it's one of the last
steps).

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to