On 4/4/06, Michele Cella <[EMAIL PROTECTED]> wrote:
>
> Max Ischenko wrote:
> > > Done at r1030.
> >
> > Well, it broke some of code that used gettext and did string
> > concatentation like this:
> >
> > return _(u'Today') + ', ' + unicode(dt.strftime('%H:%M'))
> >
> > Changing gettext into plain_gettext helped it. (Note: I added
> > plain_gettext to the list of exported symbols by i18n, r1051).
> >
>
> Maybe we can rename plain_gettext back to gettext and just introduce a
> smart_gettext (the actual gettext that checks for the request) that's
> mapped to "_" by default?

I'm not sure if this makes much of a difference. If the "smart" one is
preferred, it's probably better to leave that as "gettext" and have
plain_gettext as we do now.

Something I just thought of: the operator overloading can actually
make the above work quite nicely. What if adding to lazystring
actually kept track of what was appended and prepended. Then, at eval
time, those things are added back on. That would make Max's example
above return a lazystring that will get evaluated during the request.
In the case above, I don't think it matters because I'm sure the above
is not precomputed, but there are other cases where it might be nice
to have a message string where part of it is evaluated lazily.

Of course, the simplest solution is to implement __add__ such that the
lazystring is evaluated and concatenated.

Kevin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to