Beispiel #1
0
    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))
Beispiel #2
0
    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))
Beispiel #3
0
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")
Beispiel #4
0
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')