Ticket #220: 0003-is_rtl-recognizes-country-specific-varieties-of-RTL-.patch

File 0003-is_rtl-recognizes-country-specific-varieties-of-RTL-.patch, 1.1 KB (added by Leah Velleman, 8 years ago)
  • mediagoblin/tools/translate.py

    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"])  
    3737
    3838def is_rtl(lang):
    3939    """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
    4145
    4246def set_available_locales():
    4347    """Set available locales for which we have translations"""