I'd really like to understand this. If I set the current language to 'en',
why does en-gb get translated but en-us does not get translated?
On Sunday, March 9, 2014 10:31:57 PM UTC-4, User wrote:
>
> So why do en-us and en-gb behave differently? That is, why is en-gb
> translated and en-us not translated?
>
> On Sunday, March 9, 2014 9:04:23 PM UTC-4, Massimo Di Pierro wrote:
>>
>> Because if T.current_languages: ['en'] it means you say that 'en' does
>> not need to be translated. This is the default behaviour.
>>
>> On Friday, 7 March 2014 17:49:23 UTC-6, User wrote:
>>>
>>> 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.