Commit 66678c10 by louyihua

i18n fix

1. Add missing '_()' in capa_base.py & video_xfields.py
2. Fix a bug in instructor_dashboard.py that causes crash when ANALYTICS_DASHBOARD_NAME contains non-ascii characters.
3. Workaround for mis-extractions inside .underscore files when using gettext along with interpolate.
parent decdb117
...@@ -193,12 +193,12 @@ class CapaFields(object): ...@@ -193,12 +193,12 @@ class CapaFields(object):
scope=Scope.settings scope=Scope.settings
) )
matlab_api_key = String( matlab_api_key = String(
display_name="Matlab API key", display_name=_("Matlab API key"),
help="Enter the API key provided by MathWorks for accessing the MATLAB Hosted Service. " help=_("Enter the API key provided by MathWorks for accessing the MATLAB Hosted Service. "
"This key is granted for exclusive use by this course for the specified duration. " "This key is granted for exclusive use by this course for the specified duration. "
"Please do not share the API key with other courses and notify MathWorks immediately " "Please do not share the API key with other courses and notify MathWorks immediately "
"if you believe the key is exposed or compromised. To obtain a key for your course, " "if you believe the key is exposed or compromised. To obtain a key for your course, "
"or to report an issue, please contact moocsupport@mathworks.com", "or to report an issue, please contact moocsupport@mathworks.com"),
scope=Scope.settings scope=Scope.settings
) )
......
...@@ -163,7 +163,7 @@ class VideoFields(object): ...@@ -163,7 +163,7 @@ class VideoFields(object):
"Specify whether access to this video is limited to browsers only, or if it can be " "Specify whether access to this video is limited to browsers only, or if it can be "
"accessed from other applications including mobile apps." "accessed from other applications including mobile apps."
), ),
display_name="Video Available on Web Only", display_name=_("Video Available on Web Only"),
scope=Scope.settings, scope=Scope.settings,
default=False default=False
) )
......
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
<% if (window.ENABLE_DISCUSSION_HOME_PANEL) { %> <% if (window.ENABLE_DISCUSSION_HOME_PANEL) { %>
<span class="label label-settings"> <span class="label label-settings">
<%- interpolate(gettext("How to use %(platform_name)s discussions"), {platform_name: window.PLATFORM_NAME}, true) %> <%- interpolate(
gettext("How to use %(platform_name)s discussions"),
{platform_name: window.PLATFORM_NAME}, true
) %>
</span> </span>
<table class="home-helpgrid"> <table class="home-helpgrid">
<tr class="helpgrid-row helpgrid-row-navigation"> <tr class="helpgrid-row helpgrid-row-navigation">
......
...@@ -583,7 +583,7 @@ def _section_analytics(course, access): ...@@ -583,7 +583,7 @@ def _section_analytics(course, access):
insights_message = _("For analytics about your course, go to {analytics_dashboard_name}.") insights_message = _("For analytics about your course, go to {analytics_dashboard_name}.")
insights_message = insights_message.format( insights_message = insights_message.format(
analytics_dashboard_name='{0}{1}</a>'.format(link_start, settings.ANALYTICS_DASHBOARD_NAME) analytics_dashboard_name=u'{0}{1}</a>'.format(link_start, settings.ANALYTICS_DASHBOARD_NAME)
) )
section_data = { section_data = {
'section_key': 'instructor_analytics', 'section_key': 'instructor_analytics',
......
<div class="provider-wrapper"> <div class="provider-wrapper">
<div class="provider-info"> <div class="provider-info">
<%= interpolate(gettext("You still need to visit the %s website to complete the credit process."), [display_name]) %> <%= interpolate(
gettext("You still need to visit the %(display_name)s website to complete the credit process."),
{ display_name: displayname }, true
) %>
</div> </div>
<div class="provider-more-info"> <div class="provider-more-info">
<%= interpolate(gettext("To finalize course credit, %s requires %s learners to submit a credit request."), [provider_id.toUpperCase(), platformName]) %> <%= interpolate(
gettext("To finalize course credit, %(provider_id)s requires %(platform_name)s learners to submit a credit request."),
{ provider_id: provider_id.toUpperCase(), platform_name: platformName }, true
) %>
</div> </div>
<div class="provider-instructions"> <div class="provider-instructions">
<%= fulfillment_instructions %> <%= fulfillment_instructions %>
......
<div class="wrapper-content-main payment-confirmation-step"> <div class="wrapper-content-main payment-confirmation-step">
<article class="content-main"> <article class="content-main">
<h3 class="title"> <h3 class="title">
<%= interpolate(gettext( "Thank you! We have received your payment for %s"), ["<span class='course_name_placeholder'></span>"]) %> <%= interpolate(
gettext( "Thank you! We have received your payment for %(course_name)s."),
{ course_name: "<span class='course_name_placeholder'></span>" }, true
) %>
</h3> </h3>
<% if ( receipt ) { %> <% if ( receipt ) { %>
......
...@@ -12,7 +12,12 @@ ...@@ -12,7 +12,12 @@
<span class="course-code"><%= content.number %></span> <span class="course-code"><%= content.number %></span>
<span class="course-title"><%= content.display_name %></span> <span class="course-title"><%= content.display_name %></span>
</h2> </h2>
<div class="course-date" aria-hidden="true"><%= interpolate(gettext("Starts: %s"), [start]) %></div> <div class="course-date" aria-hidden="true">
<%= interpolate(
gettext("Starts: %(start_date)s"),
{ start_date: start }, true
) %>
</div>
</section> </section>
<div class="sr"> <div class="sr">
<ul> <ul>
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<%= <%=
interpolate( interpolate(
// Translators: Any text between %(screen_reader_start)s and %(screen_reader_end)s is only read by screen readers and never shown in the browser. // Translators: Any text between %(screen_reader_start)s and %(screen_reader_end)s is only read by screen readers and never shown in the browser.
'%(screen_reader_start)sWarning:%(screen_reader_end)s The previously selected content group was deleted. Select another content group.', gettext('%(screen_reader_start)sWarning:%(screen_reader_end)s The previously selected content group was deleted. Select another content group.'),
{ {
screen_reader_start: '<span class="sr">', screen_reader_start: '<span class="sr">',
screen_reader_end: '</span>' screen_reader_end: '</span>'
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<%= <%=
interpolate( interpolate(
// Translators: Any text between %(screen_reader_start)s and %(screen_reader_end)s is only read by screen readers and never shown in the browser. // Translators: Any text between %(screen_reader_start)s and %(screen_reader_end)s is only read by screen readers and never shown in the browser.
'%(screen_reader_start)sWarning:%(screen_reader_end)s No content groups exist.', gettext('%(screen_reader_start)sWarning:%(screen_reader_end)s No content groups exist.'),
{ {
screen_reader_start: '<span class="sr">', screen_reader_start: '<span class="sr">',
screen_reader_end: '</span>' screen_reader_end: '</span>'
......
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