if not request.env.accept_languge: request.env.accept_language='de-de'
and now you default to german.
You can use other conditions to set the accept_language (for example
ask the user and store the preference in session). That is up to you.
Notice that it and it-it are treated as different languages so to
support italian you need both.
Massimo
def trans():
request.env.http_accept_language='de-de'
import gluon.languages
gluon.languages.translator.__init__(T,request) # reloads the
language file
return T("Hello World")
this should work assuming you have a language de-de.py and you have a
translation string for "Hello World". This will override the
http_accept_language unless you check if you have it.
Anyway, this is ugly, I need to come up with a better way, something
like
def trans():
T.defaults_to('de-de') // not yet implemented
return T("Hello World")
Massimo
> def trans():
> request.env.accept_language='de-de'
> return T("Hello World")
Anyway my feeling is that it should really be the client's browser to
set the language, not the application.
Massimo