>
> var set_info_text = function (txt) {
> $('#info_text').innerHTML = '{{=T(txt)}}';
> };
>
> Keep in mind that the web2py template syntax is Python that gets executed
on the sever in order to generate the HTML page. On the other hand, any
JavaScript in the page gets executed in the browser, after the HTML has
been generated on the server. You cannot mix JavaScript and Python as if
they will be executed in the same context.
In the above, the {{=T(txt)}} will be executed only once on the server when
the HTML page is generated. The problem is that the "txt" variable passed
to T() doesn't actually exist in Python on the server, so you are getting
that error.
If you need to use JS to dynamically insert web2py translations into the
page, you would have to make Ajax calls to the server to request and
receive the translated strings. Hard to say whether that's actually a good
idea without knowing more about what you are trying to do.
Anthony
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.