From 60ac026b80b16f09b967521d4394f6e5e94bf9c9 Mon Sep 17 00:00:00 2001
From: Leah Velleman <leah.velleman@gmail.com>
Date: Tue, 21 Jun 2016 18:32:43 -0400
Subject: [PATCH 3/3] is_rtl recognizes country-specific varieties of RTL
languages, e.g. ar_IQ for Iraqi Arabic
---
mediagoblin/tools/translate.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mediagoblin/tools/translate.py b/mediagoblin/tools/translate.py
index a5e56cf..ee549c1 100644
a
|
b
|
KNOWN_RTL = set(["ar", "fa", "he", "iw", "ur", "yi", "ji"])
|
37 | 37 | |
38 | 38 | def is_rtl(lang): |
39 | 39 | """Returns true when the local language is right to left""" |
40 | | return lang in KNOWN_RTL |
| 40 | for locale in KNOWN_RTL: |
| 41 | if lang.startswith(locale): # To allow for nation-specific varieties, e.g. |
| 42 | # ar-IQ for Iraqi Arabic |
| 43 | return True |
| 44 | return False |
41 | 45 | |
42 | 46 | def set_available_locales(): |
43 | 47 | """Set available locales for which we have translations""" |