def multilingual(request): """ Returns context variables containing information about available languages. """ codes = sorted(get_all()) return {'ML_LANGUAGE': get_active(), # DEPRECATED context #TODO: LANGUAGE_CODES, LANGUAGE_CODES_AND_NAMES available in i18n context processor 'LANGUAGE_CODES': codes, 'LANGUAGE_CODES_AND_NAMES': get_dict(), 'DEFAULT_LANGUAGE_CODE': get_settings_default()}
def multilingual(request): """ Returns context variables containing information about available languages. """ codes = sorted(get_all()) return { "ML_LANGUAGE": get_active(), # DEPRECATED context # TODO: LANGUAGE_CODES, LANGUAGE_CODES_AND_NAMES available in i18n context processor "LANGUAGE_CODES": codes, "LANGUAGE_CODES_AND_NAMES": get_dict(), "DEFAULT_LANGUAGE_CODE": get_settings_default(), "ADMIN_MEDIA_URL": settings.ADMIN_MEDIA_PREFIX, }
def test01_basics(self): self.assertEqual(languages.get_dict(), SortedDict(self.LANGUAGES)) self.assertEqual(languages.get_all(), ['cs', 'en', 'en-us']) self.assertEqual(languages.get_settings_default(), 'cs') self.assertEqual(languages.get_active(), 'cs')
def test_get_settings_default(self): self.assertEqual(languages.get_settings_default(), 'cs') # Check activate has no effect on default activate('en') self.assertEqual(languages.get_settings_default(), 'cs')
def test_basics(self): self.assertEqual(languages.get_dict(), SortedDict((('cs', u'Čeština'), ('en', u'English'), ('en-us', u'American english')))) self.assertEqual(languages.get_all(), ['cs', 'en', 'en-us']) self.assertEqual(languages.get_settings_default(), 'cs') self.assertEqual(languages.get_active(), 'cs')