I made a bare bones app based on the welcome app:
In db.py:
T.current_languages = ['en']
in en-us.py:
# -*- coding: utf-8 -*-
{
'!langcode!': 'en-us',
'!langname!': 'English (American)',
'xyztest': 'Pass! (US English)'
}
in en-gb.py:
# -*- coding: utf-8 -*-
{
'!langcode!': 'en-gb',
'!langname!': 'English (British)',
'xyztest': 'Pass! (UK)'
}
In a view:
<h2>Language testing:</h2>
string: <strong>{{=T('xyztest')}}</strong><br>
current_languages: {{=T.current_languages}}<br>
T.http_accept_language: {{=T.http_accept_language}}<br>
T.accepted_language: {{=T.accepted_language}}<br>
The rendered output of this is:
string: *xyztest*
T.current_languages: ['en']
T.http_accept_language: en-us,en;q=0.5
T.accepted_language: en-us
Why does this not get translated? By contrast, if I set my browser accept
language to include en-gb the rendered output is:
string:* Pass! (UK)*
T.current_languages: ['en']
T.http_accept_language: en-gb,en-us;q=0.7,en;q=0.3
T.accepted_language: en-gb
--
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.