Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
6e4cea7b
Commit
6e4cea7b
authored
10 years ago
by
Anton Stupak
Browse files
Options
Downloads
Plain Diff
Merge pull request #3590 from edx/anton/i18n-string-response
StringResponse i18n.
parents
799c3611
d9aa28b8
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/capa/capa/responsetypes.py
+8
-2
8 additions, 2 deletions
common/lib/capa/capa/responsetypes.py
with
8 additions
and
2 deletions
common/lib/capa/capa/responsetypes.py
+
8
−
2
View file @
6e4cea7b
...
...
@@ -1375,6 +1375,7 @@ class StringResponse(LoncapaResponse):
Note: for old code, which supports _or_ separator, we add some backward compatibility handling.
Should be removed soon. When to remove it, is up to Lyla Fisher.
"""
_
=
self
.
capa_system
.
i18n
.
ugettext
# backward compatibility, should be removed in future.
if
self
.
backward
:
return
self
.
check_string_backward
(
expected
,
given
)
...
...
@@ -1386,7 +1387,10 @@ class StringResponse(LoncapaResponse):
regexp
=
re
.
compile
(
'
^
'
+
'
|
'
.
join
(
expected
)
+
'
$
'
,
flags
=
flags
|
re
.
UNICODE
)
result
=
re
.
search
(
regexp
,
given
)
except
Exception
as
err
:
msg
=
'
[courseware.capa.responsetypes.stringresponse] error: {}
'
.
format
(
err
.
message
)
msg
=
u
'
[courseware.capa.responsetypes.stringresponse] {error}: {message}
'
.
format
(
error
=
_
(
u
'
error
'
),
message
=
err
.
message
)
log
.
error
(
msg
,
exc_info
=
True
)
raise
ResponseError
(
msg
)
return
bool
(
result
)
...
...
@@ -1410,7 +1414,9 @@ class StringResponse(LoncapaResponse):
return
hints_to_show
def
get_answers
(
self
):
return
{
self
.
answer_id
:
'
<b>or</b>
'
.
join
(
self
.
correct_answer
)}
_
=
self
.
capa_system
.
i18n
.
ugettext
separator
=
u
'
<b>{}</b>
'
.
format
(
_
(
u
'
or
'
))
return
{
self
.
answer_id
:
separator
.
join
(
self
.
correct_answer
)}
#-----------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment