def i18n(request): return { 'LANGUAGES': settings.LANGUAGES, 'LANG': (settings.LANGUAGE_URL_MAP.get(translation.get_language()) or translation.get_language()), 'DIR': 'rtl' if translation.get_language_bidi() else 'ltr', }
def test_get_language_bidi(self): """Should return true if the base lang (before the dash) is "he", "ar", "fa", or "ur". List of left-to-right languages are in Django global settings and very unlikely to change. """ translation.activate('en-GB') self.assertFalse(translation.get_language_bidi()) translation.activate('de') self.assertFalse(translation.get_language_bidi()) translation.activate('ar') self.assertTrue(translation.get_language_bidi()) translation.activate('ur-PK') self.assertTrue(translation.get_language_bidi())
def i18n(request): return { "LANGUAGES": settings.LANGUAGES, "LANG": (settings.LANGUAGE_URL_MAP.get(translation.get_language()) or translation.get_language()), "DIR": "rtl" if translation.get_language_bidi() else "ltr", }