Hi there.
I also want to override _ function.
But, I'd like to override _ per request, so other "users" still have
original _ behaviour... Can that be done?


If one needs to do it globally for all requests then that's actually quite easy:
Pylons 0.9.6

        from pylons.i18n.translation import ugettext

        class MyController(....
        def my_override_action(self):
            def new_(value):
                translation = ugettext(value)
                result = '%s (%s)' % (translation, value)
                return result
            pylons.i18n._ = new_

Above will append translation key, to each translated text..


PS. I've built an online interface to i18n translations, so that
translator can translate *.po/*.mo files directly on the Pylons
webapp! :)

T.

On Thu, Mar 26, 2009 at 8:17 AM, Uwe Feldtmann<u...@microshare.com.au> wrote:
> Thanks for the response Philip.
>
> I have raised ticket #593 as a feature request.
>
> Uwe.
>
> Philip Jenvey wrote:
>
> On Mar 24, 2009, at 1:17 AM, Uwe Feldtmann wrote:
>
>
>
> Hi all.
>
> I am still trying to find a way to override _ in pylons.
>
> Have looked through pylons.templating and have tried everything I can
> think of.
>
> Can someone tell me how and where I can replace pylons._ aka _()
> with my
> own version?
>
>
> Assuming you're using the new render_mako/etc methods, looks like you
> can't. So you'll have to make your own render method. Or you could
> monkey patch the i18n module =[
>
> Can you log a ticket for this? This should really be allowed
>
> --
> Philip Jenvey
>
>
>
>
>
> >
>



-- 
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'________________JKM-UPR
_iii__'patsystem.sf.net'___________________linux_user
_'aspectized.com'___________________________prevayler

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to