From 3d62e247d058468f26c3187b1a1f0bc131090bc1 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Fri, 5 Feb 2016 00:46:28 +0100 Subject: [PATCH] refactor the way channel meta data is translated --- kalite/distributed/custom_context_processors.py | 7 +------ kalite/settings/base.py | 11 ++++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/kalite/distributed/custom_context_processors.py b/kalite/distributed/custom_context_processors.py index 0a989e34e8..e624e0e738 100644 --- a/kalite/distributed/custom_context_processors.py +++ b/kalite/distributed/custom_context_processors.py @@ -6,7 +6,6 @@ * App settings, including version / build ID """ from django.conf import settings -from django.utils.translation import ugettext as _ from kalite import version from kalite.topic_tools import settings as topic_tools_settings @@ -14,16 +13,12 @@ def custom(request): - channel_data_trans = {} - for key, value in settings.KALITE_CHANNEL_CONTEXT_DATA.items(): - channel_data_trans[key] = _(value) - return { "central_server_host": settings.CENTRAL_SERVER_HOST, "central_server_domain": settings.CENTRAL_SERVER_DOMAIN, "securesync_protocol": settings.SECURESYNC_PROTOCOL, "base_template": "distributed/base.html", - "channel_data": channel_data_trans, + "channel_data": settings.KALITE_CHANNEL_CONTEXT_DATA, "channel": topic_tools_settings.CHANNEL, "is_central": False, "settings": settings, diff --git a/kalite/settings/base.py b/kalite/settings/base.py index 9ca9a45e75..b9ad1f8fb5 100644 --- a/kalite/settings/base.py +++ b/kalite/settings/base.py @@ -9,6 +9,7 @@ from kalite import ROOT_DATA_PATH from kalite.shared.warnings import RemovedInKALite_v016_Warning +from django.utils.translation import ugettext_lazy # Load local settings first... loading it again later to have the possibility # to overwrite default app settings.. very strange method, will be refactored @@ -250,11 +251,11 @@ # Context data included by ka lite's context processor KALITE_CHANNEL_CONTEXT_DATA = { - "channel_name": u"KA Lite", - "head_line": u"A free world-class education for anyone anywhere.", - "tag_line": u"KA Lite is a light-weight web server for viewing and interacting with core Khan Academy content (videos and exercises) without needing an Internet connection.", - "channel_license": u"CC-BY-NC-SA", - "footer_text": u"Videos © 2015 Khan Academy (Creative Commons) // Exercises © 2015 Khan Academy", + "channel_name": ugettext_lazy(u"KA Lite"), + "head_line": ugettext_lazy(u"A free world-class education for anyone anywhere."), + "tag_line": ugettext_lazy(u"KA Lite is a light-weight web server for viewing and interacting with core Khan Academy content (videos and exercises) without needing an Internet connection."), + "channel_license": ugettext_lazy(u"CC-BY-NC-SA"), + "footer_text": ugettext_lazy(u"Videos © 2015 Khan Academy (Creative Commons) // Exercises © 2015 Khan Academy"), "header_logo": os.path.join(STATIC_URL, 'images', 'horizontal-logo-small.png'), "frontpage_splash": os.path.join(STATIC_URL, 'images', 'logo_10_enlarged_2.png'), }