I do not like the way web2py distinguish 'en' and 'en-en' as two
different languages, so I wrote a simple code which fix it.
lang = request.env.http_accept_language.split(',')[0].split(';')
[0].split('-')[0]
if lang not in [all_available_languages]: lang = DEFAULT_LANG
T.force(lang)
I have also few questions.
1. Where to put Python code which should be shared by all web2py
controllers but also parsed on *every* request? I found that T.force()
has to be executed BEFORE any T() method is used otherwise it won't
work.
2. Where is the best place for global variables (variables available
in all controllers, but parsed only once)
3. Is there any API for extracting all translation languages used in
the project? I would like to get the list of all available languages.
4. How to get absolute filepath to the current application?
--
JZ
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---