Code

Ticket #4389: bidi.diff

File bidi.diff, 902 bytes (added by jezdez, 7 years ago)

Added proposed support for _expand_lang

Line 
1Index: django/utils/translation/trans_real.py
2===================================================================
3--- django/utils/translation/trans_real.py      (revision 6783)
4+++ django/utils/translation/trans_real.py      (working copy)
5@@ -237,6 +237,10 @@
6     from django.conf import settings
7     return settings.LANGUAGE_CODE
8 
9+def get_possible_language_names():
10+    "Returns a list of possible names for the given language"
11+    return gettext_module._expand_lang(to_locale(get_language()))
12+
13 def get_language_bidi():
14     """
15     Returns selected language's BiDi layout.
16@@ -244,7 +248,10 @@
17     True = right-to-left layout
18     """
19     from django.conf import settings
20-    return get_language() in settings.LANGUAGES_BIDI
21+    for language in get_possible_language_names():
22+        if language in settings.LANGUAGES_BIDI:
23+            return True
24+    return False
25 
26 def catalog():
27     """