def test_get_locale_path(self): """get_locale_path returns path to locale or null if it doesnt exist""" EXISTING_LOCALES = ( 'af', 'ar-sa', 'ar-sasa', 'de', 'et', 'pl', 'pl-pl', 'ru', 'pt-br', 'zh-tw' ) for language in EXISTING_LOCALES: self.assertIsNotNone(get_locale_path(language)) NONEXISTING_LOCALES = ( 'ga', 'en', 'en-us', 'martian', ) for language in NONEXISTING_LOCALES: self.assertIsNone(get_locale_path(language))
def test_get_locale_path(self): """get_locale_path returns path to locale or null if it doesnt exist""" EXISTING_LOCALES = ('af', 'ar-sa', 'ar-sasa', 'de', 'et', 'pl', 'pl-pl', 'ru', 'pt-br', 'zh-tw') for language in EXISTING_LOCALES: self.assertIsNotNone(get_locale_path(language)) NONEXISTING_LOCALES = ( 'ga', 'en', 'en-us', 'martian', ) for language in NONEXISTING_LOCALES: self.assertIsNone(get_locale_path(language))
def momentjs_catalog(request): locale_path = momentjs.get_locale_path(get_language()) if locale_path: with open(locale_path, "r") as locale_file: locale = locale_file.read() else: locale = "" return HttpResponse(locale, content_type="application/javascript; charset=utf-8")
def momentjs_catalog(request): locale_path = momentjs.get_locale_path(get_language()) if locale_path: with open(locale_path, "r") as locale_file: locale = locale_file.read() else: locale = "" return HttpResponse(locale, content_type='application/javascript; charset=utf-8')