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
520822c3
Commit
520822c3
authored
Jan 09, 2014
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2122 from edx/ned/i18n-xblock-support
Make LMS use runtime.service("i18n") for i18n.
parents
96558c85
d138a2c6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
5 deletions
+13
-5
common/lib/xmodule/xmodule/capa_module.py
+1
-1
common/lib/xmodule/xmodule/video_module.py
+1
-1
common/lib/xmodule/xmodule/x_module.py
+2
-0
lms/djangoapps/courseware/module_render.py
+8
-2
requirements/edx/github.txt
+1
-1
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
520822c3
...
@@ -22,7 +22,6 @@ from xmodule.exceptions import NotFoundError, ProcessingError
...
@@ -22,7 +22,6 @@ from xmodule.exceptions import NotFoundError, ProcessingError
from
xblock.fields
import
Scope
,
String
,
Boolean
,
Dict
,
Integer
,
Float
from
xblock.fields
import
Scope
,
String
,
Boolean
,
Dict
,
Integer
,
Float
from
.fields
import
Timedelta
,
Date
from
.fields
import
Timedelta
,
Date
from
django.utils.timezone
import
UTC
from
django.utils.timezone
import
UTC
from
django.utils.translation
import
ugettext
as
_
log
=
logging
.
getLogger
(
"edx.courseware"
)
log
=
logging
.
getLogger
(
"edx.courseware"
)
...
@@ -359,6 +358,7 @@ class CapaModule(CapaFields, XModule):
...
@@ -359,6 +358,7 @@ class CapaModule(CapaFields, XModule):
"""
"""
# The logic flow is a little odd so that _('xxx') strings can be found for
# The logic flow is a little odd so that _('xxx') strings can be found for
# translation while also running _() just once for each string.
# translation while also running _() just once for each string.
_
=
self
.
runtime
.
service
(
self
,
"i18n"
)
.
ugettext
check
=
_
(
'Check'
)
check
=
_
(
'Check'
)
final_check
=
_
(
'Final Check'
)
final_check
=
_
(
'Final Check'
)
...
...
common/lib/xmodule/xmodule/video_module.py
View file @
520822c3
...
@@ -21,7 +21,6 @@ import copy
...
@@ -21,7 +21,6 @@ import copy
from
django.http
import
Http404
from
django.http
import
Http404
from
django.conf
import
settings
from
django.conf
import
settings
from
django.utils.translation
import
ugettext
as
_
from
xmodule.x_module
import
XModule
from
xmodule.x_module
import
XModule
from
xmodule.editing_module
import
TabsEditingDescriptor
from
xmodule.editing_module
import
TabsEditingDescriptor
...
@@ -302,6 +301,7 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
...
@@ -302,6 +301,7 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
else
:
else
:
return
''
return
''
_
=
self
.
runtime
.
service
(
self
,
"i18n"
)
.
ugettext
video_url
.
update
({
video_url
.
update
({
'help'
:
_
(
'A YouTube URL or a link to a file hosted anywhere on the web.'
),
'help'
:
_
(
'A YouTube URL or a link to a file hosted anywhere on the web.'
),
'display_name'
:
'Video URL'
,
'display_name'
:
'Video URL'
,
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
520822c3
...
@@ -362,6 +362,7 @@ descriptor_attr = partial(ProxyAttribute, 'descriptor') # pylint: disable=inval
...
@@ -362,6 +362,7 @@ descriptor_attr = partial(ProxyAttribute, 'descriptor') # pylint: disable=inval
module_runtime_attr
=
partial
(
ProxyAttribute
,
'xmodule_runtime'
)
# pylint: disable=invalid-name
module_runtime_attr
=
partial
(
ProxyAttribute
,
'xmodule_runtime'
)
# pylint: disable=invalid-name
@XBlock.needs
(
"i18n"
)
class
XModule
(
XModuleMixin
,
HTMLSnippet
,
XBlock
):
# pylint: disable=abstract-method
class
XModule
(
XModuleMixin
,
HTMLSnippet
,
XBlock
):
# pylint: disable=abstract-method
""" Implements a generic learning module.
""" Implements a generic learning module.
...
@@ -563,6 +564,7 @@ class ResourceTemplates(object):
...
@@ -563,6 +564,7 @@ class ResourceTemplates(object):
return
None
return
None
@XBlock.needs
(
"i18n"
)
class
XModuleDescriptor
(
XModuleMixin
,
HTMLSnippet
,
ResourceTemplates
,
XBlock
):
class
XModuleDescriptor
(
XModuleMixin
,
HTMLSnippet
,
ResourceTemplates
,
XBlock
):
"""
"""
An XModuleDescriptor is a specification for an element of a course. This
An XModuleDescriptor is a specification for an element of a course. This
...
...
lms/djangoapps/courseware/module_render.py
View file @
520822c3
...
@@ -12,8 +12,8 @@ from django.contrib.auth.models import User
...
@@ -12,8 +12,8 @@ from django.contrib.auth.models import User
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.http
import
Http404
from
django.http
import
Http404
,
HttpResponse
from
django.http
import
HttpResponse
import
django.utils
from
django.views.decorators.csrf
import
csrf_exempt
,
csrf_protect
from
django.views.decorators.csrf
import
csrf_exempt
,
csrf_protect
from
capa.xqueue_interface
import
XQueueInterface
from
capa.xqueue_interface
import
XQueueInterface
...
@@ -419,6 +419,12 @@ def get_module_for_descriptor_internal(user, descriptor, field_data_cache, cours
...
@@ -419,6 +419,12 @@ def get_module_for_descriptor_internal(user, descriptor, field_data_cache, cours
mixins
=
descriptor
.
runtime
.
mixologist
.
_mixins
,
# pylint: disable=protected-access
mixins
=
descriptor
.
runtime
.
mixologist
.
_mixins
,
# pylint: disable=protected-access
wrappers
=
block_wrappers
,
wrappers
=
block_wrappers
,
get_real_user
=
user_by_anonymous_id
,
get_real_user
=
user_by_anonymous_id
,
services
=
{
# django.utils.translation implements the gettext.Translations
# interface (it has ugettext, ungettext, etc), so we can use it
# directly as the runtime i18n service.
'i18n'
:
django
.
utils
.
translation
,
},
)
)
# pass position specified in URL to module through ModuleSystem
# pass position specified in URL to module through ModuleSystem
...
...
requirements/edx/github.txt
View file @
520822c3
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
-e git+https://github.com/eventbrite/zendesk.git@d53fe0e81b623f084e91776bcf6369f8b7b63879#egg=zendesk
-e git+https://github.com/eventbrite/zendesk.git@d53fe0e81b623f084e91776bcf6369f8b7b63879#egg=zendesk
# Our libraries:
# Our libraries:
-e git+https://github.com/edx/XBlock.git@
fa88607
#egg=XBlock
-e git+https://github.com/edx/XBlock.git@
2a1efc8a413cc140d48f33fa839143ffcbd21d83
#egg=XBlock
-e git+https://github.com/edx/codejail.git@e3d98f9455#egg=codejail
-e git+https://github.com/edx/codejail.git@e3d98f9455#egg=codejail
-e git+https://github.com/edx/diff-cover.git@v0.2.6#egg=diff_cover
-e git+https://github.com/edx/diff-cover.git@v0.2.6#egg=diff_cover
-e git+https://github.com/edx/js-test-tool.git@v0.1.5#egg=js_test_tool
-e git+https://github.com/edx/js-test-tool.git@v0.1.5#egg=js_test_tool
...
...
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