fix: abstract edX-specific strings

This commit is contained in:
sarina
2021-09-02 06:06:52 -04:00
parent 85065cd95a
commit 0c74d347f7
20 changed files with 58 additions and 29 deletions

View File

@@ -173,7 +173,7 @@
<td>
&copy; {% now "Y" %} {{ platform_name }}, {% trans "All rights reserved" as tmsg %}{{ tmsg | force_escape }}.<br/>
<br/>
{% trans "Our mailing address is" as tmsg %}{{ tmsg | force_escape }}:<br/>
{% trans "Our mailing address is:" as tmsg %}{{ tmsg | force_escape }}<br/>
{{ contact_mailing_address }}
</td>
</tr>

View File

@@ -4,7 +4,7 @@
{% get_current_language as LANGUAGE_CODE %}
<title lang="{{ LANGUAGE_CODE|default:"en" }}">
{% block title %}
{% trans "edX Email" as tmsg %}{{ tmsg | force_escape }}
{% filter force_escape %}{% blocktrans %}{{ platform_name }} Email{% endblocktrans %}{% endfilter %}
{% endblock %}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

View File

@@ -327,6 +327,7 @@ class LtiProfile(models.Model):
null=True,
on_delete=models.CASCADE,
related_name='contentlibraries_lti_profile',
# Translators: 'Open edX' is a trademark, please keep this untranslated
verbose_name=_('open edx user'),
)

View File

@@ -39,9 +39,10 @@ def validate_social_link(platform_name, new_social_link):
# Ensure that the new link is valid.
if formatted_social_link is None:
required_url_stub = settings.SOCIAL_PLATFORMS[platform_name]['url_stub']
raise ValueError(_('Make sure that you are providing a valid username or a URL that contains "{url_stub}". '
'To remove the link from your edX profile, '
'leave this field blank.').format(url_stub=required_url_stub))
raise ValueError(_(
'Make sure that you are providing a valid username or a URL that contains "{url_stub}". '
'To remove the link from your {platform_name} profile, leave this field blank.'
).format(url_stub=required_url_stub, platform_name=settings.PLATFORM_NAME))
def format_social_link(platform_name, new_social_link):

View File

@@ -9,6 +9,7 @@ from unittest import mock
import ddt
from django.conf import settings
from django.http import QueryDict
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.http import urlquote_plus
from django.utils.timezone import now
@@ -613,6 +614,7 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
@override_waffle_flag(COURSE_HOME_USE_LEGACY_FRONTEND, active=True)
@override_waffle_flag(COURSE_PRE_START_ACCESS_FLAG, active=True)
@override_settings(PLATFORM_NAME="edX")
def test_masters_course_message(self):
enroll_button_html = "<button class=\"enroll-btn btn-link\">Enroll now</button>"

View File

@@ -6,6 +6,7 @@ View logic for handling course messages.
from datetime import datetime
from babel.dates import format_date, format_timedelta
from django.conf import settings
from django.contrib import auth
from django.template.loader import render_to_string
from django.utils.http import urlquote_plus
@@ -142,8 +143,10 @@ def _register_course_home_messages(request, course, user_access, course_start_da
# if a course is a Master's only course, we will not offer user ability to self-enroll
CourseHomeMessages.register_info_message(
request,
Text(_('You must be enrolled in the course to see course content. '
'Please contact your degree administrator or edX Support if you have questions.')),
Text(_(
'You must be enrolled in the course to see course content. '
'Please contact your degree administrator or {platform_name} Support if you have questions.'
)).format(platform_name=settings.PLATFORM_NAME),
title=title
)
elif not course.invitation_only: