Merge pull request #19846 from eduNEXT/lmm/date
Fix date internationalization
This commit is contained in:
@@ -29,7 +29,7 @@ from six import text_type
|
||||
% if course.advertised_start is not None:
|
||||
<div class="course-date" aria-hidden="true">${_("Starts")}: ${course.advertised_start}</div>
|
||||
% else:
|
||||
<div class="course-date localized_datetime" aria-hidden="true" data-format="shortDate" data-datetime="${course_date_string}" data-string="${_("Starts: {date}")}"></div>
|
||||
<div class="course-date localized_datetime" aria-hidden="true" data-format="shortDate" data-datetime="${course_date_string}" data-language="${LANGUAGE_CODE}" data-string="${_("Starts: {date}")}"></div>
|
||||
% endif
|
||||
</div>
|
||||
<div class="sr">
|
||||
@@ -39,7 +39,7 @@ from six import text_type
|
||||
% if course.advertised_start is not None:
|
||||
<li>${_("Starts")}: <time itemprop="startDate">${course.advertised_start}</time></li>
|
||||
% else:
|
||||
<li>${_("Starts")}: <time class="localized_datetime" itemprop="startDate" data-format="shortDate" data-datetime="${course_date_string}"></time></li>
|
||||
<li>${_("Starts")}: <time class="localized_datetime" itemprop="startDate" data-format="shortDate" data-datetime="${course_date_string}" data-language="${LANGUAGE_CODE}"></time></li>
|
||||
% endif
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<%page expression_filter="h" />
|
||||
<%namespace name='static' file='../static_content.html'/>
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
@@ -7,7 +8,7 @@ from courseware.courses import get_course_about_section
|
||||
from django.conf import settings
|
||||
from six import text_type
|
||||
from edxmako.shortcuts import marketing_link
|
||||
from openedx.core.djangolib.markup import HTML
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.core.lib.courses import course_image_url
|
||||
from six import string_types
|
||||
%>
|
||||
@@ -16,7 +17,7 @@ from six import string_types
|
||||
<%block name="headextra">
|
||||
## OG (Open Graph) title and description added below to give social media info to display
|
||||
## (https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content#tags)
|
||||
<meta property="og:title" content="${course.display_name_with_default_escaped}" />
|
||||
<meta property="og:title" content="${course.display_name_with_default}" />
|
||||
<meta property="og:description" content="${get_course_about_section(request, course, 'short_description')}" />
|
||||
</%block>
|
||||
|
||||
@@ -31,21 +32,21 @@ from six import string_types
|
||||
% if can_add_course_to_cart:
|
||||
add_course_complete_handler = function(jqXHR, textStatus) {
|
||||
if (jqXHR.status == 200) {
|
||||
location.href = "${cart_link}";
|
||||
location.href = "${cart_link | n, decode.utf8}";
|
||||
}
|
||||
if (jqXHR.status == 400) {
|
||||
$("#register_error")
|
||||
.html(jqXHR.responseText ? jqXHR.responseText : "${_("An error occurred. Please try again later.")}")
|
||||
$("#register_error").text(
|
||||
jqXHR.responseText ? jqXHR.responseText : "${_("An error occurred. Please try again later.") | n, decode.utf8}")
|
||||
.css("display", "block");
|
||||
}
|
||||
else if (jqXHR.status == 403) {
|
||||
location.href = "${reg_then_add_to_cart_link}";
|
||||
location.href = "${reg_then_add_to_cart_link | n, decode.utf8}";
|
||||
}
|
||||
};
|
||||
|
||||
$("#add_to_cart_post").click(function(event){
|
||||
$.ajax({
|
||||
url: "${reverse('add_course_to_cart', args=[text_type(course.id)])}",
|
||||
url: "${reverse('add_course_to_cart', args=[text_type(course.id)]) | n, decode.utf8}",
|
||||
type: "POST",
|
||||
/* Rant: HAD TO USE COMPLETE B/C PROMISE.DONE FOR SOME REASON DOES NOT WORK ON THIS PAGE. */
|
||||
complete: add_course_complete_handler
|
||||
@@ -57,23 +58,23 @@ from six import string_types
|
||||
## making the conditional around this entire JS block for sanity
|
||||
%if settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
|
||||
<%
|
||||
perms_error = _('The currently logged-in user account does not have permission to enroll in this course. '
|
||||
perms_error = Text(_('The currently logged-in user account does not have permission to enroll in this course. '
|
||||
'You may need to {start_logout_tag}log out{end_tag} then try the enroll button again. '
|
||||
'Please visit the {start_help_tag}help page{end_tag} for a possible solution.').format(
|
||||
start_help_tag="<a href='{url}'>".format(url=marketing_link('FAQ')), end_tag='</a>',
|
||||
start_logout_tag="<a href='{url}'>".format(url=reverse('logout'))
|
||||
'Please visit the {start_help_tag}help page{end_tag} for a possible solution.')).format(
|
||||
start_help_tag=HTML("<a href='{url}'>").format(url=marketing_link('FAQ')), end_tag=HTML('</a>'),
|
||||
start_logout_tag=HTML("<a href='{url}'>").format(url=reverse('logout'))
|
||||
)
|
||||
%>
|
||||
$('#class_enroll_form').on('ajax:complete', function(event, xhr) {
|
||||
if(xhr.status == 200) {
|
||||
location.href = "${reverse('dashboard')}";
|
||||
location.href = "${reverse('dashboard') | n, decode.utf8}";
|
||||
} else if (xhr.status == 403) {
|
||||
location.href = "${reverse('course-specific-register', args=[text_type(course.id)])}?course_id=${course.id | u}&enrollment_action=enroll";
|
||||
location.href = "${reverse('course-specific-register', args=[text_type(course.id)]) | n, decode.utf8 }?course_id=${course.id | n, decode.utf8 }&enrollment_action=enroll";
|
||||
} else if (xhr.status == 400) { //This means the user did not have permission
|
||||
$('#register_error').html("${perms_error}").css("display", "block");
|
||||
$('#register_error').text("${perms_error | n, decode.utf8}").css("display", "block");
|
||||
} else {
|
||||
$('#register_error').html(
|
||||
(xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.")}")
|
||||
$('#register_error').text(
|
||||
(xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, decode.utf8}")
|
||||
).css("display", "block");
|
||||
}
|
||||
});
|
||||
@@ -83,16 +84,16 @@ from six import string_types
|
||||
$('#class_enroll_form').on('ajax:complete', function(event, xhr) {
|
||||
if(xhr.status == 200) {
|
||||
if (xhr.responseText == "") {
|
||||
location.href = "${reverse('dashboard')}";
|
||||
location.href = "${reverse('dashboard') | n, decode.utf8}";
|
||||
}
|
||||
else {
|
||||
location.href = xhr.responseText;
|
||||
}
|
||||
} else if (xhr.status == 403) {
|
||||
location.href = "${reverse('register_user')}?course_id=${course.id | u}&enrollment_action=enroll";
|
||||
location.href = "${reverse('register_user') | n, decode.utf8 }?course_id=${course.id | n, decode.utf8 }&enrollment_action=enroll";
|
||||
} else {
|
||||
$('#register_error').html(
|
||||
(xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.")}")
|
||||
$('#register_error').text(
|
||||
(xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, decode.utf8}")
|
||||
).css("display", "block");
|
||||
}
|
||||
});
|
||||
@@ -105,7 +106,7 @@ from six import string_types
|
||||
<script src="${static.url('js/course_info.js')}"></script>
|
||||
</%block>
|
||||
|
||||
<%block name="pagetitle">${course.display_name_with_default_escaped}</%block>
|
||||
<%block name="pagetitle">${course.display_name_with_default}</%block>
|
||||
|
||||
<section class="course-info">
|
||||
|
||||
@@ -116,10 +117,10 @@ from six import string_types
|
||||
<section class="intro">
|
||||
<div class="heading-group">
|
||||
<h1>
|
||||
${course.display_name_with_default_escaped}
|
||||
${course.display_name_with_default}
|
||||
</h1>
|
||||
<br />
|
||||
<span>${course.display_org_with_default | h}</span>
|
||||
<span>${course.display_org_with_default}</span>
|
||||
</div>
|
||||
|
||||
<div class="main-cta">
|
||||
@@ -137,7 +138,7 @@ from six import string_types
|
||||
|
||||
%elif in_cart:
|
||||
<span class="add-to-cart">
|
||||
${_('This course is in your <a href="{cart_link}">cart</a>.').format(cart_link=cart_link)}
|
||||
${Text(_('This course is in your <a href="{cart_link}">cart</a>.')).format(cart_link=cart_link)}
|
||||
</span>
|
||||
% elif is_course_full:
|
||||
<span class="register disabled">
|
||||
@@ -164,8 +165,11 @@ from six import string_types
|
||||
reg_element_id = ""
|
||||
%>
|
||||
<a href="${reg_href}" class="add-to-cart" id="${reg_element_id}">
|
||||
${_("Add {course_name} to Cart <span>({price} USD)</span>")\
|
||||
.format(course_name=course.display_number_with_default, price=course_price)}
|
||||
${Text(_("Add {course_name} to Cart {start_span}({price} USD){end_span}")).format(
|
||||
course_name=course.display_number_with_default,
|
||||
start_span=HTML("<span>"),
|
||||
end_span=HTML("</span>"),
|
||||
price=course_price)}
|
||||
</a>
|
||||
<div id="register_error"></div>
|
||||
%elif allow_anonymous:
|
||||
@@ -186,7 +190,7 @@ from six import string_types
|
||||
href_class = "register"
|
||||
%>
|
||||
<a href="${reg_href}" class="${href_class}">
|
||||
${_("Enroll in {course_name}").format(course_name=course.display_number_with_default) | h}
|
||||
${_("Enroll in {course_name}").format(course_name=course.display_number_with_default)}
|
||||
</a>
|
||||
<div id="register_error"></div>
|
||||
%endif
|
||||
@@ -223,7 +227,7 @@ from six import string_types
|
||||
% endif
|
||||
|
||||
<div class="inner-wrapper">
|
||||
${get_course_about_section(request, course, "overview")}
|
||||
${HTML(get_course_about_section(request, course, "overview"))}
|
||||
</div>
|
||||
</div>
|
||||
</%block>
|
||||
@@ -235,7 +239,7 @@ from six import string_types
|
||||
|
||||
<%block name="course_about_important_dates">
|
||||
<ol class="important-dates">
|
||||
<li class="important-dates-item"><span class="icon fa fa-info-circle" aria-hidden="true"></span><p class="important-dates-item-title">${_("Course Number")}</p><span class="important-dates-item-text course-number">${course.display_number_with_default | h}</span></li>
|
||||
<li class="important-dates-item"><span class="icon fa fa-info-circle" aria-hidden="true"></span><p class="important-dates-item-title">${_("Course Number")}</p><span class="important-dates-item-text course-number">${course.display_number_with_default}</span></li>
|
||||
% if not course.start_date_is_still_default:
|
||||
<%
|
||||
course_start_date = course.advertised_start or course.start
|
||||
@@ -249,7 +253,7 @@ from six import string_types
|
||||
<%
|
||||
course_date_string = course_start_date.strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||
%>
|
||||
<span class="important-dates-item-text start-date localized_datetime" data-format="shortDate" data-datetime="${course_date_string}"></span>
|
||||
<span class="important-dates-item-text start-date localized_datetime" data-format="shortDate" data-datetime="${course_date_string}" data-language="${LANGUAGE_CODE}"></span>
|
||||
% endif
|
||||
</li>
|
||||
% endif
|
||||
@@ -269,7 +273,7 @@ from six import string_types
|
||||
<%
|
||||
course_date_string = course_end_date.strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||
%>
|
||||
<span class="important-dates-item-text final-date localized_datetime" data-format="shortDate" data-datetime="${course_date_string}"></span>
|
||||
<span class="important-dates-item-text final-date localized_datetime" data-format="shortDate" data-datetime="${course_date_string}" data-language="${LANGUAGE_CODE}"></span>
|
||||
% endif
|
||||
</li>
|
||||
% endif
|
||||
@@ -296,9 +300,9 @@ from six import string_types
|
||||
## Multiple pre-requisite courses are not supported on frontend that's why we are pulling first element
|
||||
<span class="important-dates-item-text pre-requisite"><a href="${prc_target}">${pre_requisite_courses[0]['display']}</a></span>
|
||||
<p class="tip">
|
||||
${_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.").format(
|
||||
link_start='<a href="{}">'.format(prc_target),
|
||||
link_end='</a>',
|
||||
${Text(_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.")).format(
|
||||
link_start=HTML('<a href="{}">').format(prc_target),
|
||||
link_end=HTML('</a>'),
|
||||
prc_display=pre_requisite_courses[0]['display'],
|
||||
)}
|
||||
</p>
|
||||
@@ -354,7 +358,7 @@ from six import string_types
|
||||
<form id="class_enroll_form" method="post" data-remote="true" action="${reverse('change_enrollment')}">
|
||||
<fieldset class="enroll_fieldset">
|
||||
<legend class="sr">${pgettext("self","Enroll")}</legend>
|
||||
<input name="course_id" type="hidden" value="${course.id | h}">
|
||||
<input name="course_id" type="hidden" value="${course.id }">
|
||||
<input name="enrollment_action" type="hidden" value="enroll">
|
||||
</fieldset>
|
||||
<div class="submit">
|
||||
|
||||
Reference in New Issue
Block a user