No. You should not define T in your view and your should not define T in your actions.
T should be defined outside actions (for example it is defined in common.py in _scaffold). Your actions should declare that they need it and pass it to the view: @action('index') @action.uses(index.html) @action.uses(T) def index(): return dict(T=T) now index.html can see and use T On Monday, 7 October 2019 06:06:40 UTC-7, Ruslan Gareev wrote: > > Using T in Layout.html is make me to copy-paste code from common.py to > layout.html > [[from py4web import Translator]] > [[from ..settings import T_FOLDER]] > [[T = Translator(T_FOLDER)]] > > <html> > some code > ... > <a href="[[=URL('auth/register')]]">[[=T('Sign in')]] > ... > </html> > How to make that no repeat code? > -- 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/e9496295-3914-4351-915d-626c533c753f%40googlegroups.com.