Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
0dbf7cd7
Commit
0dbf7cd7
authored
Mar 12, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check whether new translation breaks any checks
parent
4a2e2ac0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
trans/views.py
trans/views.py
+15
-0
No files found.
trans/views.py
View file @
0dbf7cd7
...
...
@@ -192,6 +192,8 @@ def translate(request, project, subproject, lang):
# We accept translations only from authenticated
messages
.
add_message
(
request
,
messages
.
ERROR
,
_
(
'You need to log in to be able to save translations!'
))
else
:
# Remember old checks
oldchecks
=
set
(
unit
.
active_checks
().
values_list
(
'check'
,
flat
=
True
))
# Update unit and save it
unit
.
target
=
join_plural
(
form
.
cleaned_data
[
'target'
])
unit
.
fuzzy
=
form
.
cleaned_data
[
'fuzzy'
]
...
...
@@ -199,6 +201,19 @@ def translate(request, project, subproject, lang):
# Update stats
profile
.
translated
+=
1
profile
.
save
()
# Get new set of checks
newchecks
=
set
(
unit
.
active_checks
().
values_list
(
'check'
,
flat
=
True
))
# Did we introduce any new failures?
if
newchecks
>=
oldchecks
:
# Show message to user
messages
.
add_message
(
request
,
messages
.
ERROR
,
_
(
'Some checks have failed on your translation!'
))
# Stay on same entry
return
HttpResponseRedirect
(
'%s?type=%s&oldpos=%d&dir=stay%s'
%
(
obj
.
get_translate_url
(),
rqtype
,
pos
,
search_url
))
# Redirect to next entry
return
HttpResponseRedirect
(
'%s?type=%s&oldpos=%d%s'
%
(
...
...
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