From 0c74d347f71c7ccf2e3910f81cccc920dfbe8e50 Mon Sep 17 00:00:00 2001 From: sarina Date: Thu, 2 Sep 2021 06:06:52 -0400 Subject: [PATCH] fix: abstract edX-specific strings --- .../contentstore/tests/test_course_settings.py | 1 + cms/templates/settings.html | 4 ++-- .../student/tests/test_verification_status.py | 1 + common/lib/xmodule/xmodule/course_module.py | 11 +++++++---- lms/djangoapps/branding/api.py | 1 + lms/djangoapps/course_home_api/outline/views.py | 7 +++++-- lms/djangoapps/courseware/views/views.py | 12 +++++++----- lms/templates/ccx/coach_dashboard.html | 3 ++- lms/templates/certificates/valid.html | 2 +- .../dashboard/_dashboard_course_listing.html | 2 +- .../dashboard/_dashboard_status_verification.html | 5 +++-- .../ace_common/edx_ace/common/base_body.html | 2 +- .../ace_common/edx_ace/common/base_head.html | 2 +- openedx/core/djangoapps/content_libraries/models.py | 1 + openedx/core/djangoapps/user_api/accounts/utils.py | 7 ++++--- .../tests/views/test_course_home.py | 2 ++ .../course_experience/views/course_home_messages.py | 7 +++++-- .../certificates/_about-accomplishments.html | 12 +++++++++--- .../lms/templates/certificates/_about-edx.html | 4 +++- .../edx.org/lms/templates/course_modes/choose.html | 1 + 20 files changed, 58 insertions(+), 29 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py index aac15a55b4..efed2e20a4 100644 --- a/cms/djangoapps/contentstore/tests/test_course_settings.py +++ b/cms/djangoapps/contentstore/tests/test_course_settings.py @@ -1795,6 +1795,7 @@ id=\"course-enrollment-end-time\" value=\"\" placeholder=\"HH:MM\" autocomplete= self._verify_editable(self._get_course_details_response(True)) @mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_PUBLISHER': True}) + @override_settings(PLATFORM_NAME='edX') def test_course_details_with_enabled_setting_non_global_staff(self): """ Test that user enrollment end date is not editable in response. diff --git a/cms/templates/settings.html b/cms/templates/settings.html index 36d3894d23..9655782709 100644 --- a/cms/templates/settings.html +++ b/cms/templates/settings.html @@ -338,7 +338,7 @@ CMS.URL.UPLOAD_ASSET = '${upload_asset_url | n, js_escaped_string}' ${_("Last day students can enroll.")} % if not enrollment_end_editable: - ${_("Contact your edX partner manager to update these settings.")} + ${_("Contact your {platform_name} partner manager to update these settings.").format(platform_name=settings.PLATFORM_NAME)} % endif @@ -359,7 +359,7 @@ CMS.URL.UPLOAD_ASSET = '${upload_asset_url | n, js_escaped_string}' ${_("Last day students can upgrade to a verified enrollment.")} - ${_("Contact your edX partner manager to update these settings.")} + ${_("Contact your {platform_name} partner manager to update these settings.").format(platform_name=settings.PLATFORM_NAME)} diff --git a/common/djangoapps/student/tests/test_verification_status.py b/common/djangoapps/student/tests/test_verification_status.py index 5ba896f508..5a3b9a828a 100644 --- a/common/djangoapps/student/tests/test_verification_status.py +++ b/common/djangoapps/student/tests/test_verification_status.py @@ -30,6 +30,7 @@ from xmodule.modulestore.tests.factories import CourseFactory @patch.dict(settings.FEATURES, {'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': True}) +@override_settings(PLATFORM_NAME='edX') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @ddt.ddt class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase): diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 720b4859cf..7d0186b5da 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -435,7 +435,9 @@ class CourseFields: # lint-amnesty, pylint: disable=missing-class-docstring ) video_upload_pipeline = Dict( display_name=_("Video Upload Credentials"), - help=_("Enter the unique identifier for your course's video files provided by edX."), + help=_( + "Enter the unique identifier for your course's video files provided by {platform_name}." + ).format(platform_name=settings.PLATFORM_NAME), scope=Scope.settings ) no_grade = Boolean( @@ -479,9 +481,10 @@ class CourseFields: # lint-amnesty, pylint: disable=missing-class-docstring # Translators: Custom Courses for edX (CCX) is an edX feature for re-using course content. CCX Coach is # a role created by a course Instructor to enable a person (the "Coach") to manage the custom course for # his students. - "Allow course instructors to assign CCX Coach roles, and allow coaches to manage Custom Courses on edX." - " When false, Custom Courses cannot be created, but existing Custom Courses will be preserved." - ), + "Allow course instructors to assign CCX Coach roles, and allow coaches to manage " + "Custom Courses on {platform_name}. When false, Custom Courses cannot be created, " + "but existing Custom Courses will be preserved." + ).format(platform_name=settings.PLATFORM_NAME), default=False, scope=Scope.settings ) diff --git a/lms/djangoapps/branding/api.py b/lms/djangoapps/branding/api.py index b311873917..c10915defe 100644 --- a/lms/djangoapps/branding/api.py +++ b/lms/djangoapps/branding/api.py @@ -360,6 +360,7 @@ def _footer_business_links(language=settings.LANGUAGE_CODE): if language == settings.LANGUAGE_CODE: links.append(('affiliates', (marketing_link("AFFILIATES"), _("Affiliates")))) + # Translators: 'Open edX' is a trademark, please keep this untranslated links.append(('openedx', (_footer_openedx_link()["url"], _("Open edX")))) links.append(('careers', (marketing_link("CAREERS"), _("Careers")))) links.append(("news", (marketing_link("NEWS"), _("News")))) diff --git a/lms/djangoapps/course_home_api/outline/views.py b/lms/djangoapps/course_home_api/outline/views.py index d37ca1720f..662d26a858 100644 --- a/lms/djangoapps/course_home_api/outline/views.py +++ b/lms/djangoapps/course_home_api/outline/views.py @@ -6,6 +6,7 @@ from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory from completion.exceptions import UnavailableCompletionData from completion.utilities import get_key_to_last_completed_block +from django.conf import settings from django.http.response import Http404 from django.shortcuts import get_object_or_404 from django.urls import reverse @@ -300,8 +301,10 @@ class OutlineTabView(RetrieveAPIView): if not show_enrolled: if CourseMode.is_masters_only(course_key): enroll_alert['can_enroll'] = False - enroll_alert['extra_text'] = _('Please contact your degree administrator or ' - 'edX Support if you have questions.') + enroll_alert['extra_text'] = _( + 'Please contact your degree administrator or ' + '{platform_name} Support if you have questions.' + ).format(platform_name=settings.PLATFORM_NAME) elif course.invitation_only: enroll_alert['can_enroll'] = False diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index 158bd65919..10e5100d3d 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -706,8 +706,10 @@ class CourseTabView(EdxFragmentView): if not CourseEnrollment.is_enrolled(request.user, course.id) and not allow_anonymous: # Only show enroll button if course is open for enrollment. if CourseTabView.course_open_for_learner_enrollment(course): - enroll_message = _('You must be enrolled in the course to see course content. \ - {enroll_link_start}Enroll now{enroll_link_end}.') + enroll_message = _( + 'You must be enrolled in the course to see course content. ' + '{enroll_link_start}Enroll now{enroll_link_end}.' + ) PageLevelMessages.register_warning_message( request, Text(enroll_message).format( @@ -2071,9 +2073,9 @@ def financial_assistance_form(request): 'placeholder': '', 'name': 'mktg-permission', 'label': _( - 'I allow edX to use the information provided in this application ' - '(except for financial information) for edX marketing purposes.' - ), + 'I allow {platform_name} to use the information provided in this application ' + '(except for financial information) for {platform_name} marketing purposes.' + ).format(platform_name=settings.PLATFORM_NAME), 'defaultValue': '', 'type': 'checkbox', 'required': False, diff --git a/lms/templates/ccx/coach_dashboard.html b/lms/templates/ccx/coach_dashboard.html index 0fb54c5848..77390602c0 100644 --- a/lms/templates/ccx/coach_dashboard.html +++ b/lms/templates/ccx/coach_dashboard.html @@ -2,6 +2,7 @@ <%inherit file="/main.html" /> <%namespace name='static' file='/static_content.html'/> <%! +from django.conf import settings from django.utils.translation import ugettext as _ from django.urls import reverse from openedx.core.djangolib.js_utils import ( @@ -47,7 +48,7 @@ from openedx.core.djangolib.js_utils import (
- +
diff --git a/lms/templates/certificates/valid.html b/lms/templates/certificates/valid.html index 4e01135c68..4e89b0f251 100644 --- a/lms/templates/certificates/valid.html +++ b/lms/templates/certificates/valid.html @@ -9,7 +9,7 @@ <%include file="_accomplishment-rendering.html" />
-
diff --git a/themes/edx.org/lms/templates/certificates/_about-edx.html b/themes/edx.org/lms/templates/certificates/_about-edx.html index 4fd4610b6d..73bc32c70f 100644 --- a/themes/edx.org/lms/templates/certificates/_about-edx.html +++ b/themes/edx.org/lms/templates/certificates/_about-edx.html @@ -4,11 +4,13 @@ from django.utils.translation import ugettext as _ from openedx.core.djangolib.markup import HTML, Text %>
+ ## Translators: This string will not be used in Open edX installations. -
\ No newline at end of file + diff --git a/themes/edx.org/lms/templates/course_modes/choose.html b/themes/edx.org/lms/templates/course_modes/choose.html index 7f68201ed9..82fd918880 100644 --- a/themes/edx.org/lms/templates/course_modes/choose.html +++ b/themes/edx.org/lms/templates/course_modes/choose.html @@ -120,6 +120,7 @@ from openedx.core.djangolib.markup import HTML, Text
  • ${Text(_("{b_start}Graded Assignments: {b_end}Build your skills through graded assignments and projects.")).format(**b_tag_kwargs)}
  • % endif
  • ${Text(_("{b_start}Easily Sharable: {b_end}Add the certificate to your CV or resumé, or post it directly on LinkedIn.")).format(**b_tag_kwargs)}
  • + ## Translators: This string will not be used in Open edX installations.
  • ${Text(_("{b_start}Support our Mission: {b_end}EdX, a non-profit, relies on verified certificates to help fund affordable education to everyone globally.")).format(**b_tag_kwargs)}
  • % else: