How to use T.force('ar') to allow the system support m开发者_如何学运维ultiple language.
i have two links into my page when Arabic link is pressed the system will converted to Arabic version and also when English link is pressed the system will converted to English version.
how to force language on click of link??
and also how can i allow data into database to be translated using "T"
Thanks in advance
In web2py. Make a model that contains something like
if re.compile('\w{2}(\-\w{2})?').match(request.vars.force_language or ''):
session.forced_language=force_language
if session.forced_language:
T.force(session.forced_language)
the call any of the page with
http://....../index?force_language=ar
The system will store it in session and remember your preference. Will translate if languages/ar.py exists.
精彩评论