Commit 3b14ee8a by louyihua

Fix a decode error in course_about.html and make some string translatable

The strings in share links should be in unicode, otherwise when the name of a course is non-ascii, it will generate a decode error.
And some of these strings is actually translatable, so they should be collected into mako.po.
parent 8708c37a
...@@ -236,30 +236,33 @@ ...@@ -236,30 +236,33 @@
site_domain = microsite.get_value('site_domain', 'www.edx.org') site_domain = microsite.get_value('site_domain', 'www.edx.org')
platform_name = microsite.get_value('platform_name', 'edX') platform_name = microsite.get_value('platform_name', 'edX')
tweet_action = "http://twitter.com/intent/tweet?text=I+just+registered+for+{number}+{title}+through+{account}:+{url}".format( # Translators: This text will be automatically posted to the student's
# Twitter account. {url} should appear at the end of the text.
tweet_text = _("I just registered for {number} {title} through {account}: {url}").format(
number=course.number, number=course.number,
title=get_course_about_section(course, 'title').encode('utf-8'), title=get_course_about_section(course, 'title'),
account=microsite.get_value('course_about_twitter_account', '@edxonline'), account=microsite.get_value('course_about_twitter_account', '@edxonline'),
url="http://{domain}{path}".format( url=u"http://{domain}{path}".format(
domain=site_domain, domain=site_domain,
path=reverse('about_course', args=[course.id]) path=reverse('about_course', args=[course.id])
) )
) ).replace(u" ", u"+")
tweet_action = u"http://twitter.com/intent/tweet?text={tweet_text}".format(tweet_text=tweet_text)
facebook_link = microsite.get_value('course_about_facebook_link', 'http://www.facebook.com/EdxOnline') facebook_link = microsite.get_value('course_about_facebook_link', 'http://www.facebook.com/EdxOnline')
email_subject = "mailto:?subject={subject}&body={body}".format( email_subject = u"mailto:?subject={subject}&body={body}".format(
subject="Take a course with {platform} online".format(platform=platform_name), subject=_("Take a course with {platform} online").format(platform=platform_name),
body="I just registered for {number} {title} through {platform} {url}".format( body=_("I just registered for {number} {title} through {platform} {url}").format(
number=course.number, number=course.number,
title=get_course_about_section(course, 'title'), title=get_course_about_section(course, 'title'),
platform=platform_name, platform=platform_name,
url="http://{domain}{path}".format( url=u"http://{domain}{path}".format(
domain=site_domain, domain=site_domain,
path=reverse('about_course', args=[course.id]), path=reverse('about_course', args=[course.id]),
) )
) )
).replace(" ", "%20") ).replace(u" ", u"%20")
%> %>
<a href="${tweet_action}" class="share"> <a href="${tweet_action}" class="share">
<img src="${static.url('images/social/twitter-sharing.png')}" alt="Tweet that you've registered for this course"> <img src="${static.url('images/social/twitter-sharing.png')}" alt="Tweet that you've registered for this course">
......
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