You have to pass T to the view

@action('index')
@action.uses('index.html', T)
def index():
     return dict(message="hello world", T=T)
# in view .... [[=T(message)]]

or 

@unauthenticated
def index():
     return dict(message="hello world")

and it is all automatic. Need the latest common.py from scaffold.


On Monday, 17 February 2020 19:08:05 UTC-8, clara wrote:
>
> Hi,
>
> I just tried using translations in a template in py4web: [[ =T('some 
> text') ]]
>
> but it doesn't work. I tried importing T in the template but then I got:
>
> "No module named 'yatl.common'"
>
> Probably I am overlooking something...
>
> Any help will be appreciated! 
>
> Thanks,
>
> Clara
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/158199db-53ce-4e75-becc-ac15b6794db6%40googlegroups.com.

Reply via email to