#9340: `translation.get_language()` should process `settings.LANGUAGE_CODE`
----------------------------------+-----------------------------------------
 Reporter:  jcassee               |       Owner:  nobody    
   Status:  new                   |   Milestone:            
Component:  Internationalization  |     Version:  1.0       
 Keywords:                        |       Stage:  Unreviewed
Has_patch:  0                     |  
----------------------------------+-----------------------------------------
 When `translation.get_language_from_request()` processes the `Accept-
 Language` HTTP header it makes sure to remove the 'sublanguage'
 (territory) code if it is not in `settings.LANGUAGES`. So for example, if
 the HTTP headers contain `Accept-Language: en_US` and `LANGUAGES = ('en',
 ...)`, then `get_language_from_request()` returns `'en'`. However, if
 language negotiation fails then `get_language_from_request()` returns
 `settings.LANGUAGE_CODE` without checking `LANGUAGES`. Using default
 settings, `get_language_from_request()` would return `'en-us'` while
 `LANGUAGES` only contains `'en'`.

 This behaviour is inconsistent. Either `get_language_from_request()`
 should not remove the sublanguage code from the negotiated language or it
 should also do so for the default language. In other words, either

  1. `translation.get_language()` is always in `LANGUAGES`, or
  1. `translation.get_language()` or its root language is always in
 `LANGUAGES`.

 In the first case, 'en-us' should not be the default `LANGUAGE_CODE` (at
 least not as returned from `get_language()`). In the second case Django
 should not strip the sublanguage from the negotiated language code.

 Because installations that do not use content negotiation will never call
 `get_language_from_request()` any stripping of the sublanguage code might
 need to be moved to `translation.get_language()`.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9340>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to