Skip to content

Commit

Permalink
refactor the way channel meta data is translated
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaoming committed Feb 4, 2016
1 parent 6f4ea20 commit 3d62e24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 1 addition & 6 deletions kalite/distributed/custom_context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,19 @@
* 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


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,
Expand Down
11 changes: 6 additions & 5 deletions kalite/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
}
Expand Down

0 comments on commit 3d62e24

Please sign in to comment.