Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
fe2e4a74
Commit
fe2e4a74
authored
Jan 20, 2016
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11273 from openfun/fun/fix_default_email_localization
Fix (un)enrollment email default language
parents
31841bdc
5fee7480
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
lms/djangoapps/instructor/enrollment.py
+1
-0
lms/djangoapps/instructor/tests/test_api_email_localization.py
+9
-1
No files found.
lms/djangoapps/instructor/enrollment.py
View file @
fe2e4a74
...
...
@@ -427,6 +427,7 @@ def render_message_to_string(subject_template, message_template, param_dict, lan
Returns two strings that correspond to the rendered, translated email
subject and message.
"""
language
=
language
or
settings
.
LANGUAGE_CODE
with
override_language
(
language
):
return
get_subject_and_message
(
subject_template
,
message_template
,
param_dict
)
...
...
lms/djangoapps/instructor/tests/test_api_email_localization.py
View file @
fe2e4a74
...
...
@@ -5,13 +5,14 @@ Unit tests for the localization of emails sent by instructor.api methods.
from
django.core
import
mail
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
from
nose.plugins.attrib
import
attr
from
courseware.tests.factories
import
InstructorFactory
from
lang_pref
import
LANGUAGE_KEY
from
student.models
import
CourseEnrollment
from
student.tests.factories
import
UserFactory
from
openedx.core.djangoapps.user_api.preferences.api
import
set_user_preference
from
openedx.core.djangoapps.user_api.preferences.api
import
set_user_preference
,
delete_user_preference
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
...
...
@@ -89,3 +90,10 @@ class TestInstructorAPIEnrollmentEmailLocalization(SharedModuleStoreTestCase):
# Student is unknown, so the platform language should be used
self
.
update_enrollement
(
"enroll"
,
"newuser@hotmail.com"
)
self
.
check_outbox
(
"You have been"
)
@override_settings
(
LANGUAGE_CODE
=
"fr"
)
def
test_user_without_preference_receives_email_in_french
(
self
):
delete_user_preference
(
self
.
student
,
LANGUAGE_KEY
)
self
.
update_enrollement
(
"enroll"
,
self
.
student
.
email
)
self
.
check_outbox_is_french
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment