Changeset 973
- Timestamp:
- 10/20/05 02:36:44 (3 years ago)
- Files:
-
- django/branches/i18n/django/utils/translation.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/i18n/django/utils/translation.py
r964 r973 115 115 global _translations 116 116 117 if language == 'en' or language.startswith('en-'):118 return gettext_module.NullTranslations()119 120 117 t = _translations.get(language, None) 121 118 if t is not None: … … 291 288 lang_code = request.GET.get('django_language', None) or request.POST.get('django_language', None) 292 289 if lang_code is not None: 293 if lang_code == 'en' or lang_code.startswith('en-'):294 return lang_code295 290 lang = gettext_module.find('django', globalpath, [to_locale(lang_code)]) 296 291 if lang is not None: … … 304 299 lang_code = request.session.get('django_language', None) 305 300 if lang_code is not None: 306 if lang_code == 'en' or lang_code.startswith('en-'):307 return lang_code308 301 lang = gettext_module.find('django', globalpath, [to_locale(lang_code)]) 309 302 if lang is not None: … … 312 305 lang_code = request.COOKIES.get('django_language', None) 313 306 if lang_code is not None: 314 if lang_code == 'en' or lang_code.startswith('en-'):315 return lang_code316 307 lang = gettext_module.find('django', globalpath, [to_locale(lang_code)]) 317 308 if lang is not None: … … 342 333 343 334 for lang, order in langs: 344 if lang == 'en' or lang.startswith('en-'): 345 # special casing for language en and derivates, because we don't 346 # have an english language file available, but just fallback 347 # to NullTranslation on those languages (as the source itself 348 # is in english) 335 langfile = gettext_module.find('django', globalpath, [to_locale(lang)]) 336 if langfile: 337 # reconstruct the actual language from the language 338 # filename, because otherwise we might incorrectly 339 # report de_DE if we only have de available, but 340 # did find de_DE because of language normalization 341 lang = langfile[len(globalpath):].split('/')[1] 349 342 _accepted[accept] = lang 350 343 return lang 351 else:352 langfile = gettext_module.find('django', globalpath, [to_locale(lang)])353 if langfile:354 # reconstruct the actual language from the language355 # filename, because otherwise we might incorrectly356 # report de_DE if we only have de available, but357 # did find de_DE because of language normalization358 lang = langfile[len(globalpath):].split('/')[1]359 _accepted[accept] = lang360 return lang361 344 362 345 return settings.LANGUAGE_CODE
