commit 7bde75e2a89c0bdeceed567643d467ce3846ab56 Author: aagbsn aagbsn@extc.org Date: Thu Jun 27 17:46:13 2013 +0200
Use fallback languages --- lib/bridgedb/HTTPServer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/bridgedb/HTTPServer.py b/lib/bridgedb/HTTPServer.py index 380439a..c181d63 100644 --- a/lib/bridgedb/HTTPServer.py +++ b/lib/bridgedb/HTTPServer.py @@ -282,9 +282,13 @@ def setLocaleFromRequestHeader(request): localedir=os.path.join(os.path.dirname(__file__), 'i18n/')
if langs: - langs = filter(lambda x: re.match('^[a-z_]{1,5}$', x), langs) + langs = filter(lambda x: re.match('^[a-z-]{1,5}$', x), langs) logging.debug("Languages: %s" % langs) - map(lambda x: x.replace("-","_").lower(),langs) + # add fallback languages + langs_only = filter(lambda x: '-' in x, langs) + langs.extend(map(lambda x: x.split('-')[0], langs_only)) + # gettext wants _, not - + map(lambda x: x.replace('-', '_'), langs) lang = gettext.translation("bridgedb", localedir=localedir, - languages=langs, fallback=True) + languages=langs, fallback=True) lang.install(True)
tor-commits@lists.torproject.org