Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Gracefully handle non available languages

Roland Geider40606f13f5a1
diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.py
index c388417a2..1acf9a97d 100644
--- a/wger/utils/context_processor.py
+++ b/wger/utils/context_processor.py
@@ -21,6 +21,7 @@ from django.utils.translation import get_language
# wger
from wger.config.models import GymConfig
from wger.utils import constants
+from wger.utils.constants import ENGLISH_SHORT_NAME
from wger.utils.language import get_language_data
@@ -39,7 +40,9 @@ def processor(request):
'twitter': settings.WGER_SETTINGS['TWITTER'],
# Languages
- 'i18n_language': get_language_data((get_language(), languages_dict[get_language()])),
+ 'i18n_language': get_language_data(
+ (get_language(), languages_dict.get(get_language(), ENGLISH_SHORT_NAME)),
+ ),
'languages': settings.AVAILABLE_LANGUAGES,
# The current path