Commit 09fddc3b authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents 31f54091 0dcf0c7a
...@@ -25,6 +25,7 @@ from weblate.trans.models import Project, SubProject, Translation ...@@ -25,6 +25,7 @@ from weblate.trans.models import Project, SubProject, Translation
from weblate.lang.models import Language from weblate.lang.models import Language
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
import django.utils.translation import django.utils.translation
from django.utils.translation import trans_real
def get_translation(request, project, subproject, lang, skip_acl=False): def get_translation(request, project, subproject, lang, skip_acl=False):
...@@ -101,9 +102,13 @@ def try_set_language(lang): ...@@ -101,9 +102,13 @@ def try_set_language(lang):
try: try:
django.utils.translation.activate(lang) django.utils.translation.activate(lang)
# workaround for https://code.djangoproject.com/ticket/26050
# pylint: disable=W0212
if trans_real.catalog()._catalog is None:
raise Exception('Invalid language!')
except Exception: except Exception:
# Ignore failure on activating language # Ignore failure on activating language
pass django.utils.translation.activate('en')
try: try:
return Language.objects.get(code=lang) return Language.objects.get(code=lang)
except Language.DoesNotExist: except Language.DoesNotExist:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment