tags:

views:

141

answers:

2

i have a menu

MENU([['Users', False, URL(r=request,f='user',vars=dict(forced_language=session.lang))]])

and i wanna to translate users to other languages when i put T before it like:

MENU([['T('Users')', False, URL(r=request,f='user',vars=dict(forced_language=session.lang))]])

It cause invalid syntax so how can i do that ??

and also how to use T to translate words in view ??

i want to translate word "language" in the following line: language_multiselect_form=form_factory('a',SQLField('language',db.language,requires=IS_IN_DB(db,'language.id','language.name',multiple=True)))

Thanks in Advance

+1  A: 

You have too many quotes:

MENU([[T('Users'), False, URL(r=request,f='user',vars=dict(forced_language=session.lang))]])
mdipierro
How to use T in view E.x:`<h1>Registration Form </h1>`
Neveen
A: 

Translating strings in views in web2py should be rather easy:

<h2>Hello World</h2>

Would become:

<h2>{=T('Hello World')}</h2>

Or Even better:

<h2>{=XML(T('Hello World'))}</h2>

Use XML() to ensure proper escaping whenever possible.

Also, obviously you should have an available translation for your strings in your language dictionary for your application.

Speedbird