﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7720	LocaleMiddleware doesn't fallback to the first part of the language code when it's received from the user's browser in a cookie	Djoume Salvetti	Ramiro Morales	"Hi,

I have a project where the language cookie is set by another system (under the same domain). 

This system set the LANGUAGE_COOKIE to 'fr-ca' or 'en-us'.

I have in my settings file:

{{{
#!python
LANGUAGES = ( 
    ('en', ugettext('English')),
    ('fr', ugettext('French')),
)
}}}

According to the documentation, this should restrict languages that are available for automatic selection to French and English (and any sublanguage, like fr-ca or en-us).

This is true when the language is set in the HTTP Header (ie fr-ca matches fr) but not when the language is set in the LANGUAGE_COOKIE by another system.

The attached patch is a tentative to fix this (it works for me).

"		closed	Internationalization	dev		fixed	cookie fallback language sublanguage root language	dsalvetti@…	Accepted	1	0	0	0	0	0
