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
dfbfd7b2
Commit
dfbfd7b2
authored
May 22, 2014
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3802 from louyihua/translation-fix
i18n: Make checklists translatable
parents
7044cbb8
34d2f051
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
cms/djangoapps/contentstore/views/checklist.py
+21
-2
cms/templates/checklists.html
+2
-2
common/lib/xmodule/xmodule/course_module.py
+0
-0
No files found.
cms/djangoapps/contentstore/views/checklist.py
View file @
dfbfd7b2
...
@@ -16,6 +16,8 @@ from .access import has_course_access
...
@@ -16,6 +16,8 @@ from .access import has_course_access
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore.locator
import
BlockUsageLocator
from
xmodule.modulestore.locator
import
BlockUsageLocator
from
django.utils.translation
import
ugettext
__all__
=
[
'checklists_handler'
]
__all__
=
[
'checklists_handler'
]
...
@@ -79,7 +81,7 @@ def checklists_handler(request, tag=None, package_id=None, branch=None, version_
...
@@ -79,7 +81,7 @@ def checklists_handler(request, tag=None, package_id=None, branch=None, version_
course_module
.
save
()
course_module
.
save
()
modulestore
.
update_item
(
course_module
,
request
.
user
.
id
)
modulestore
.
update_item
(
course_module
,
request
.
user
.
id
)
expanded_checklist
=
expand_checklist_action_url
(
course_module
,
persisted_checklist
)
expanded_checklist
=
expand_checklist_action_url
(
course_module
,
persisted_checklist
)
return
JsonResponse
(
expanded_checklist
)
return
JsonResponse
(
localize_checklist_text
(
expanded_checklist
)
)
else
:
else
:
return
HttpResponseBadRequest
(
return
HttpResponseBadRequest
(
(
"Could not save checklist state because the checklist index "
(
"Could not save checklist state because the checklist index "
...
@@ -99,7 +101,7 @@ def expand_all_action_urls(course_module):
...
@@ -99,7 +101,7 @@ def expand_all_action_urls(course_module):
"""
"""
expanded_checklists
=
[]
expanded_checklists
=
[]
for
checklist
in
course_module
.
checklists
:
for
checklist
in
course_module
.
checklists
:
expanded_checklists
.
append
(
expand_checklist_action_url
(
course_module
,
checklist
))
expanded_checklists
.
append
(
localize_checklist_text
(
expand_checklist_action_url
(
course_module
,
checklist
)
))
return
expanded_checklists
return
expanded_checklists
...
@@ -127,3 +129,20 @@ def expand_checklist_action_url(course_module, checklist):
...
@@ -127,3 +129,20 @@ def expand_checklist_action_url(course_module, checklist):
item
[
'action_url'
]
=
location
.
url_reverse
(
url_prefix
,
''
)
item
[
'action_url'
]
=
location
.
url_reverse
(
url_prefix
,
''
)
return
expanded_checklist
return
expanded_checklist
def
localize_checklist_text
(
checklist
):
"""
Localize texts for a given checklist and returns the modified version.
The method does an in-place operation so the input checklist is modified directly.
"""
# Localize checklist name
checklist
[
'short_description'
]
=
ugettext
(
checklist
[
'short_description'
])
# Localize checklist items
for
item
in
checklist
.
get
(
'items'
):
item
[
'short_description'
]
=
ugettext
(
item
[
'short_description'
])
item
[
'long_description'
]
=
ugettext
(
item
[
'long_description'
])
item
[
'action_text'
]
=
ugettext
(
item
[
'action_text'
])
if
item
[
'action_text'
]
!=
""
else
u""
return
checklist
cms/templates/checklists.html
View file @
dfbfd7b2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
utils
.
translation
import
ugettext
as
_
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
%
>
<
%
block
name=
"title"
>
Course Checklists
</
%
block>
<
%
block
name=
"title"
>
${_("Course Checklists")}
</
%
block>
<
%
block
name=
"bodyclass"
>
is-signedin course view-checklists
</
%
block>
<
%
block
name=
"bodyclass"
>
is-signedin course view-checklists
</
%
block>
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
...
@@ -64,7 +64,7 @@ require(["domReady!", "jquery", "js/collections/checklist", "js/views/checklist"
...
@@ -64,7 +64,7 @@ require(["domReady!", "jquery", "js/collections/checklist", "js/views/checklist"
</div>
</div>
<div
class=
"bit"
>
<div
class=
"bit"
>
<h3
class=
"title title-3"
>
Studio checklists
</h3>
<h3
class=
"title title-3"
>
${_("Studio checklists")}
</h3>
<nav
class=
"nav-page checklists-current"
>
<nav
class=
"nav-page checklists-current"
>
<ol>
<ol>
% for checklist in checklists:
% for checklist in checklists:
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
dfbfd7b2
This diff is collapsed.
Click to expand it.
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