From 9a0da7d670d6f4f168a85a6ca871ecf4601ad849 Mon Sep 17 00:00:00 2001 From: louyihua Date: Mon, 13 Apr 2015 13:10:19 +0800 Subject: [PATCH] Better i18n Combine sentences in several pages for better translation. --- lms/templates/dashboard.html | 1 - .../dashboard/_dashboard_course_listing.html | 59 +++++++++++++------ lms/templates/navigation.html | 3 +- .../registration_code_receipt.html | 26 ++++---- .../registration_code_redemption.html | 11 ++-- lms/templates/shoppingcart/shopping_cart.html | 6 +- 6 files changed, 68 insertions(+), 38 deletions(-) diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 30fd076816..04f208c489 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -392,7 +392,6 @@

- ? , ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index f9991f9362..5e7933689c 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -168,63 +168,81 @@ from student.helpers import ( % if is_paid_course and show_refund_option: ## Translators: The course name will be added to the end of this sentence. % if not is_course_blocked: - + ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif % elif is_paid_course and not show_refund_option: ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - + ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif % elif enrollment.mode != "verified": ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - + ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif % elif show_refund_option: ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - + ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif % else: ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - + ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif @@ -365,4 +383,9 @@ from student.helpers import ( }); } }); + + function set_unenroll_message(track_info, refund_info) { + document.getElementById('track-info').innerHTML = interpolate(track_info, {course_number: ""}, true); + document.getElementById('refund-info').innerHTML = refund_info; + } diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index 625def68e6..00e9c31e1c 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -70,7 +70,8 @@ site_status_msg = get_site_status_msg(course_id) % endif %if settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD','') and user.is_staff:
  • - Sysadmin + ## Translators: This is short for "System administration". + ${_("Sysadmin")}
  • %endif diff --git a/lms/templates/shoppingcart/registration_code_receipt.html b/lms/templates/shoppingcart/registration_code_receipt.html index 1dd0cb3d97..9c1e80b4f1 100644 --- a/lms/templates/shoppingcart/registration_code_receipt.html +++ b/lms/templates/shoppingcart/registration_code_receipt.html @@ -21,8 +21,11 @@ from courseware.courses import course_image_url, get_course_about_section alt="${course.display_number_with_default | h} ${get_course_about_section(course, 'title')} Cover Image"/>
    -
    ${_("Confirm your enrollment for:")} - ${_("course dates")} +
    + ${_("Confirm your enrollment for: {span_start}course dates{span_end}").format( + span_start='', + span_end='' + )}
    @@ -37,11 +40,14 @@ from courseware.courses import course_image_url, get_course_about_section
    % if reg_code_already_redeemed: - <% dashboard_url = reverse('dashboard')%>

    ${_("You've clicked a link for an enrollment code that has already been used." - " Check your course dashboard to see if you're enrolled in the course," - " or contact your company's administrator.").format(dashboard_url=dashboard_url)} + " Check your {link_start}course dashboard{link_end} to see if you're enrolled in the course," + " or contact your company's administrator." + ).format( + link_start=u''.format(url=reverse('dashboard')), + link_end='' + )}

    % elif redemption_success:

    @@ -49,23 +55,23 @@ from courseware.courses import course_image_url, get_course_about_section " This course has now been added to your dashboard.").format(course_name=course.display_name)}

    % elif registered_for_course: - <% dashboard_url = reverse('dashboard')%>

    ${_("You're already enrolled for this course." - " Visit your dashboard to see the course.").format(dashboard_url=dashboard_url)} + " Visit your {link_start}dashboard{link_end} to see the course." + ).format( + link_start=u''.format(url=reverse('dashboard')), + link_end='' + )}

    % elif course_full: - <% dashboard_url = reverse('dashboard')%>

    ${_("The course you are enrolling for is full.")}

    % elif enrollment_closed: - <% dashboard_url = reverse('dashboard')%>

    ${_("The course you are enrolling for is closed.")}

    % elif redeem_code_error: - <% dashboard_url = reverse('dashboard')%>

    ${_("There was an error processing your redeem code.")}

    diff --git a/lms/templates/shoppingcart/registration_code_redemption.html b/lms/templates/shoppingcart/registration_code_redemption.html index 4af7ec31a3..8552d9d407 100644 --- a/lms/templates/shoppingcart/registration_code_redemption.html +++ b/lms/templates/shoppingcart/registration_code_redemption.html @@ -24,8 +24,11 @@ from courseware.courses import course_image_url, get_course_about_section )}" />
    -
    ${_("Confirm your enrollment for:")} - ${_("course dates")} +
    + ${_("Confirm your enrollment for: {span_start}course dates{span_end}").format( + span_start='', + span_end='' + )}
    @@ -50,7 +53,7 @@ from courseware.courses import course_image_url, get_course_about_section "to see if you're enrolled in the course, or contact your " "company's administrator." ).format( - link_start=''.format(url=reverse('dashboard')), + link_start=u''.format(url=reverse('dashboard')), link_end='', )}

    @@ -69,7 +72,7 @@ from courseware.courses import course_image_url, get_course_about_section "You're already enrolled for this course. " "Visit your {link_start}dashboard{link_end} to see the course." ).format( - link_start=''.format(url=reverse('dashboard')), + link_start=u''.format(url=reverse('dashboard')), link_end='', )}

    diff --git a/lms/templates/shoppingcart/shopping_cart.html b/lms/templates/shoppingcart/shopping_cart.html index 309203662b..2a0156511d 100644 --- a/lms/templates/shoppingcart/shopping_cart.html +++ b/lms/templates/shoppingcart/shopping_cart.html @@ -113,16 +113,14 @@ from django.utils.translation import ugettext as _ ${form_html}

    - ${_('After this purchase is complete,')}
    ${order.user.username} - ${_('will be enrolled in this course.')} + ${_('After this purchase is complete, {username} will be enrolled in this course.').format(username=u'
    {username}'.format(username=order.user.username))}

    % else:
    ${form_html}

    - ${_('After this purchase is complete,')}
    ${order.user.username} - ${_('will be enrolled in this course.')} + ${_('After this purchase is complete, {username} will be enrolled in this course.').format(username=u'
    {username}'.format(username=order.user.username))}