diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-12 11:48:27 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-12 11:48:27 +0000 |
| commit | 176c4545f626f74d34cb441c5f254d09dd63eb91 (patch) | |
| tree | e618342c1324436c2f807690c11ca71b29a848b4 /django | |
| parent | d442731eb2af671d93550426cf061713a50468d2 (diff) | |
changed layout of language stuff to be oriented after locale names, not language names (from accept-language header)
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@848 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/conf/locale/pt_BR/LC_MESSAGES/django.mo (renamed from django/conf/locale/pt-br/LC_MESSAGES/django.mo) | bin | 5588 -> 5588 bytes | |||
| -rw-r--r-- | django/conf/locale/pt_BR/LC_MESSAGES/django.po (renamed from django/conf/locale/pt-br/LC_MESSAGES/django.po) | 0 | ||||
| -rw-r--r-- | django/utils/translation.py | 10 |
3 files changed, 4 insertions, 6 deletions
diff --git a/django/conf/locale/pt-br/LC_MESSAGES/django.mo b/django/conf/locale/pt_BR/LC_MESSAGES/django.mo Binary files differindex 395b7554e3..395b7554e3 100644 --- a/django/conf/locale/pt-br/LC_MESSAGES/django.mo +++ b/django/conf/locale/pt_BR/LC_MESSAGES/django.mo diff --git a/django/conf/locale/pt-br/LC_MESSAGES/django.po b/django/conf/locale/pt_BR/LC_MESSAGES/django.po index c005bb39d8..c005bb39d8 100644 --- a/django/conf/locale/pt-br/LC_MESSAGES/django.po +++ b/django/conf/locale/pt_BR/LC_MESSAGES/django.po diff --git a/django/utils/translation.py b/django/utils/translation.py index 96c98f691a..0ffd4a2e43 100644 --- a/django/utils/translation.py +++ b/django/utils/translation.py @@ -271,6 +271,9 @@ def get_language_from_request(request): else: lang = el order = 100 + if lang.find('-') >= 0: + (lang, sublang) = lang.split('-') + lang = lang.lower() + '_' + sublang.upper() return (lang, order) langs = [_parsed(el) for el in accept.split(',')] @@ -279,14 +282,9 @@ def get_language_from_request(request): globalpath = os.path.join(os.path.dirname(settings.__file__), 'locale') for lang, order in langs: - if lang == 'en' or os.path.isfile(os.path.join(globalpath, lang, 'LC_MESSAGES', 'django.mo')): + if lang == 'en' or lang.startswith('en_') or gettext_module.find('django', globalpath, [lang]): _accepted[accept] = lang return lang - elif lang.find('-') >= 0: - (lang, sublang) = lang.split('-', 1) - if lang == 'en' or os.path.isfile(os.path.join(globalpath, lang, 'LC_MESSAGES', 'django.mo')): - _accepted[accept] = lang - return lang return settings.LANGUAGE_CODE |
