MCPcopy
hub / github.com/django/django / test_translation_loading

Method test_translation_loading

tests/i18n/tests.py:512–530  ·  view source on GitHub ↗

"loading_app" does not have translations for all languages provided by "loading". Catalogs are merged correctly.

(self)

Source from the content-addressed store, hash-verified

510 INSTALLED_APPS=["i18n.loading_app"],
511 )
512 def test_translation_loading(self):
513 """
514 "loading_app" does not have translations for all languages provided by
515 "loading". Catalogs are merged correctly.
516 """
517 tests = [
518 ("en", "local country person"),
519 ("en_AU", "aussie"),
520 ("en_NZ", "kiwi"),
521 ("en_CA", "canuck"),
522 ]
523 # Load all relevant translations.
524 for language, _ in tests:
525 activate(language)
526 # Catalogs are merged correctly.
527 for language, nickname in tests:
528 with self.subTest(language=language):
529 activate(language)
530 self.assertEqual(gettext("local country person"), nickname)
531
532
533class TranslationThreadSafetyTests(SimpleTestCase):

Callers

nothing calls this directly

Calls 2

activateFunction · 0.90
gettextFunction · 0.90

Tested by

no test coverage detected