#11915: language range request should return sublanguage
---------------------------------------------+------------------------------
Reporter: galund | Owner: nobody
Status: new | Milestone:
Component: Internationalization | Version: SVN
Resolution: | Keywords:
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by ramiro):
* needs_better_patch: => 0
* needs_tests: => 0
* version: 1.0 => SVN
* needs_docs: => 0
* stage: Unreviewed => Design decision needed
Old description:
> If a user's browser includes a request for a language range including a
> parent language, sub-languages which match should be returned.
>
> For example, if a user's browser sends a header
> Accept-Language: pt
>
> And my site has
> LANGUAGES = (
> #...
> ('pt-br', 'Português (Brazil)'),
> #...
> )
>
> Then the pt_BR locale files I have should be used. (RFC 2616: 'A
> language-range matches a language-tag if it exactly equals the tag, or if
> it exactly equals a prefix of the tag such that the first tag character
> following the prefix is "-".')
>
> Right now the only way to get the Portugese returned is for me to relabel
> my local to just "pt" (which works except that the language will now be
> mislabelled in the Content-Language header).
New description:
If a user's browser includes a request for a language range including a
parent language, sub-languages which match should be returned.
For example, if a user's browser sends a header
{{{
Accept-Language: pt
}}}
And my site has
{{{
LANGUAGES = (
#...
('pt-br', 'Português (Brazil)'),
#...
)
}}}
Then the pt_BR locale files I have should be used. (RFC 2616: 'A language-
range matches a language-tag if it exactly equals the tag, or if it
exactly equals a prefix of the tag such that the first tag character
following the prefix is "-".')
Right now the only way to get the Portugese returned is for me to relabel
my local to just "pt" (which works except that the language will now be
mislabelled in the Content-Language header).
Comment:
This takes us to the following possible scenario: What if the `LANGUAGES`
setting has, in addition to `'pt-br'`, `'pt-cv'` (Portuguese as spoken in
Cape Verde)? How and why should Django choose `'pt-br'` in preference to
`'pt-cv'` (or vice versa) if a translation to `'pt'` is missing?
(The fact I'm using `pt`, `pt-br` and `pt-cv` in this example is just
incidental, the real issue is what matters)
--
Ticket URL: <http://code.djangoproject.com/ticket/11915#comment:1>
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.