Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Switched es-ES to es and wrote a test. Bug 580548.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Wenzel committed Aug 11, 2010
1 parent 1610e7c commit 631e78c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/feedback/tests.py
Expand Up @@ -61,7 +61,7 @@ def test_ua_parse(self):
self.assert_(parsed is None)

def test_detect_language(self):
"""Check Accept-Language matching."""
"""Check Accept-Language matching for feedback submission."""
patterns = (
('en-us,en;q=0.7,de;q=0.8', 'en-US'),
('fr-FR,de-DE;q=0.5', 'fr'),
Expand Down
19 changes: 19 additions & 0 deletions apps/input/tests.py
Expand Up @@ -23,6 +23,25 @@ def test_urlparams_unicode(self):


class MiddlewareTests(test_utils.TestCase):
def test_locale_fallback(self):
"""
Any specific flavor of a language (xx-YY) should return its generic
site (xx) if it exists.
"""
patterns = (
('en-us,en;q=0.7,de;q=0.8', 'en-US'),
('fr-FR,de-DE;q=0.5', 'fr'),
('zh, en-us;q=0.8, en;q=0.6', 'en-US'), # TODO should match forward?
('xx-YY,es-ES;q=0.7,de-DE;q=0.5', 'es'),
('German', 'en-US'), # invalid
)

for pattern in patterns:
res = self.client.get('/', HTTP_ACCEPT_LANGUAGE=pattern[0])
eq_(res.status_code, 301)
self.assertTrue(res['Location'].rstrip('/').endswith(pattern[1]))


def test_mobilesite_nohost(self):
"""Make sure we serve the desktop site if there's no HTTP_HOST set."""
# This won't contain HTTP_HOST. Must not fail.
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Expand Up @@ -69,7 +69,7 @@

# Accepted locales
# ar, he: bug 580573
INPUT_LANGUAGES = ('ca', 'cs', 'da', 'de', 'el', 'en-US', 'es-ES', 'fr', 'gl',
INPUT_LANGUAGES = ('ca', 'cs', 'da', 'de', 'el', 'en-US', 'es', 'fr', 'gl',
'hu', 'it', 'nb-NO', 'nl', 'pl', 'pt-PT', 'ru', 'sk', 'sq',
'uk', 'vi', 'zh-CN', 'zh-TW')
RTL_LANGUAGES = ('ar', 'he',) # ('fa', 'fa-IR')
Expand Down

0 comments on commit 631e78c

Please sign in to comment.