diff --git a/i2p2www/__init__.py b/i2p2www/__init__.py index da0380e5..1cd3dc79 100644 --- a/i2p2www/__init__.py +++ b/i2p2www/__init__.py @@ -73,6 +73,10 @@ SUPPORTED_LANG_NAMES = { 'uk': u'Ukrainian', } +RTL_LANGS = [ + 'he', + ] + DEFAULT_GETTEXT_DOMAIN = 'priority' GETTEXT_DOMAIN_MAPPING = { 'about': ['about'], diff --git a/i2p2www/pages/global/layout.html b/i2p2www/pages/global/layout.html index 53ad5de8..aea67980 100644 --- a/i2p2www/pages/global/layout.html +++ b/i2p2www/pages/global/layout.html @@ -1,6 +1,6 @@ {%- from "global/macros" import change_lang with context -%} - + {% block title_outer %}{% block title %}{% endblock %} - I2P{% endblock %} diff --git a/i2p2www/templatevars.py b/i2p2www/templatevars.py index 5ba2dcf9..6955b847 100644 --- a/i2p2www/templatevars.py +++ b/i2p2www/templatevars.py @@ -1,7 +1,7 @@ from flask import g, request, safe_join, url_for import os.path -from i2p2www import CANONICAL_DOMAIN, CURRENT_I2P_VERSION, SUPPORTED_LANGS, SUPPORTED_LANG_NAMES, STATIC_DIR, app +from i2p2www import CANONICAL_DOMAIN, CURRENT_I2P_VERSION, RTL_LANGS, SUPPORTED_LANGS, SUPPORTED_LANG_NAMES, STATIC_DIR, app INPROXY = '.us' @@ -35,6 +35,14 @@ def utility_processor(): lang = g.lang return url_for(endpoint, lang=lang, **args) + def is_rtl_lang(lang=None): + if not lang: + if hasattr(g, 'lang') and g.lang: + lang = g.lang + else: + lang = 'en' + return lang in RTL_LANGS + # Get a specific language flag, or the flag for the current language def get_flag(lang=None): if not lang: @@ -102,6 +110,7 @@ def utility_processor(): logo_url=get_logo_for_theme, site_url=get_site_url, get_url=get_url_with_lang, + is_rtl=is_rtl_lang, get_flag=get_flag, ver=get_current_version, canonical=get_canonical_link,