diff --git a/django/utils/formats.py b/django/utils/formats.py
a
|
b
|
|
24 | 24 | format_locations.append(settings.FORMAT_MODULE_PATH + '.%s') |
25 | 25 | format_locations.reverse() |
26 | 26 | locale = to_locale(lang) |
27 | | locales = set((locale, locale.split('_')[0])) |
| 27 | locales = [locale] |
| 28 | if '_' in locale: |
| 29 | locales.append(locale.split('_')[0]) |
28 | 30 | for location in format_locations: |
29 | 31 | for loc in locales: |
30 | 32 | try: |
diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py
a
|
b
|
|
480 | 480 | settings.FORMAT_MODULE_PATH = old_format_module_path |
481 | 481 | deactivate() |
482 | 482 | |
| 483 | def test_iter_format_modules_stability(self): |
| 484 | """ |
| 485 | Tests the iter_format_modules function always yields format modules in |
| 486 | a stable and correct order in presence of both base ll and ll_CC formats. |
| 487 | """ |
| 488 | try: |
| 489 | old_l10n, settings.USE_L10N = settings.USE_L10N, True |
| 490 | en_format_mod = import_module('django.conf.locale.en.formats') |
| 491 | en_gb_format_mod = import_module('django.conf.locale.en_GB.formats') |
| 492 | self.assertEqual(list(iter_format_modules('en-gb')), [en_gb_format_mod, en_format_mod]) |
| 493 | finally: |
| 494 | settings.USE_L10N = old_l10n |
| 495 | |
483 | 496 | def test_localize_templatetag_and_filter(self): |
484 | 497 | """ |
485 | 498 | Tests the {% localize %} templatetag |