Skip to content

Commit

Permalink
fix translate calls in Course About Page
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarIthawi committed Nov 23, 2022
1 parent cd26583 commit 234cfe2
Showing 1 changed file with 15 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@

<%
course_image = course_vars['course_image']

courseware_button_already_enrolled_text = template_settings.get('courseware-button-already-enrolled-text', _("You are enrolled in this course"))
courseware_button_view_courseware_text = template_settings.get('courseware-button-view-courseware-text', _("View Course"))
courseware_button_in_cart_text = template_settings.get('courseware-button-in-cart-text', _("Course is in your cart."))
courseware_button_course_full_text = template_settings.get('courseware-button-course-full-text', _("Course is full"))
courseware_button_invitation_only_text = template_settings.get('courseware-button-invitation-only-text', _("Enrollment in this course is by invitation only"))
courseware_button_enrollment_closed_text = template_settings.get('courseware-button-enrollment-closed-text', _("Enrollment is Closed"))
courseware_button_add_to_cart_text = u"{text} {price}".format(text=template_settings.get('courseware-button-add-to-cart-text', _("Add to Cart / Price: ")), price=course_vars['course_price'])
courseware_button_enroll_text_part = translate(template_settings.get('courseware-button-enroll-text', _("Enroll in ")))
courseware_button_enroll_text = u"{text} {name}".format(text=courseware_button_enroll_text_part, name=course_vars['course_name'])
view_in_studio_button_text = template_settings.get('view-in-studio-button-text', _("View About Page in studio"))
courseware_button_add_to_cart_text = _("{add_to_cart_button_text} {course_price}").format(
add_to_cart_button_text=translate(template_settings.get('courseware-button-add-to-cart-text'), _("Add to Cart / Price: ")),
course_price=course_vars['course_price'],
)
%>

<section class="a--course-about-01__header">
Expand Down Expand Up @@ -50,28 +43,28 @@ <h1 class="a--course-about-01__header__title">${course_vars['course_name']}</h1>
% if course_vars['user_authenticated'] and course_vars['course_registered']:
% if course_vars['show_courseware_link']:
<a href="${course_vars['course_href_target']}" class="a--course-about-01__courseware-btn">
${translate(courseware_button_view_courseware_text)}
${translate(template_settings.get('courseware-button-view-courseware-text'), _("View Course"))}
</a>
% else:
<span class="a--course-about-01__courseware-btn register disabled">
${translate(courseware_button_already_enrolled_text)}
${translate(template_settings.get('courseware-button-already-enrolled-text'), _("You are enrolled in this course"))}
</span>
% endif
% elif course_vars['course_in_cart']:
<a href="${course_vars['cart_link']}" class="a--course-about-01__courseware-btn add-to-cart">
${translate(courseware_button_already_enrolled_text)}
${translate(template_settings.get('courseware-button-already-enrolled-text'), _("You are enrolled in this course"))}
</a>
% elif course_vars['course_is_full']:
<span class="a--course-about-01__courseware-btn register disabled">
${translate(courseware_button_course_full_text)}
${translate(template_settings.get('courseware-button-course-full-text'), _("Course is full"))}
</span>
% elif course_vars['course_is_invitation_only'] and not course_vars['user_can_enroll']:
<span class="a--course-about-01__courseware-btn register disabled">
${translate(courseware_button_invitation_only_text)}
${translate(template_settings.get('courseware-button-invitation-only-text'), _("Enrollment in this course is by invitation only"))}
</span>
% elif not course_vars['is_shib_course'] and not course_vars['user_can_enroll']:
<span class="a--course-about-01__courseware-btn register disabled">
${translate(courseware_button_enrollment_closed_text)}
${translate(template_settings.get('courseware-button-enrollment-closed-text'), _("Enrollment is Closed"))}
</span>
% elif course_vars['can_add_course_to_cart']:
% if course_vars['user_authenticated']:
Expand All @@ -85,14 +78,17 @@ <h1 class="a--course-about-01__header__title">${course_vars['course_name']}</h1>
% endif
% else:
<a href="#" class="a--course-about-01__courseware-btn register">
${translate(courseware_button_enroll_text)}
${_("{enroll_course_text} {course_name}").format(
enroll_course_text=translate(template_settings.get('courseware-button-enroll-text'), _("Enroll in ")),
course_name=course_vars['course_name'],
)}
</a>
<div id="register_error"></div>
% endif

% if course_vars['user_has_staff_access'] and course_vars['course_studio_url'] is not None:
<a href="${course_vars['course_studio_url']}" class="a--course-about-01__courseware-btn">
${translate(view_in_studio_button_text)}
${translate(template_settings.get('view-in-studio-button-text'), _("View About Page in studio"))}
</a>
% endif
</div>
Expand Down

0 comments on commit 234cfe2

Please sign in to comment.