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
11a906ef
Commit
11a906ef
authored
Jan 17, 2013
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
21a38080
d00ae81b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
58 deletions
+62
-58
weblate/trans/models.py
weblate/trans/models.py
+42
-36
weblate/trans/views.py
weblate/trans/views.py
+20
-22
No files found.
weblate/trans/models.py
View file @
11a906ef
...
...
@@ -2130,13 +2130,13 @@ class Translation(models.Model):
# Detect changes
if
unit
.
target
!=
get_target
(
pounit
)
or
unit
.
fuzzy
!=
pounit
.
isfuzzy
():
# Update fuzzy flag
pounit
.
markfuzzy
(
unit
.
fuzzy
)
# Store translations
if
unit
.
is_plural
():
pounit
.
settarget
(
unit
.
get_target_plurals
())
else
:
pounit
.
settarget
(
unit
.
target
)
# Update fuzzy flag
pounit
.
markfuzzy
(
unit
.
fuzzy
)
# Optionally add unit to translation file
if
add
:
if
isinstance
(
store
,
LISAfile
):
...
...
@@ -2553,7 +2553,7 @@ class Unit(models.Model):
except
FileLockException
:
logger
.
error
(
'failed to lock backend for %s!'
,
self
)
messages
.
error
(
request
,
_
(
'Failed to store message in the backend, lock timeout occurred!'
))
return
return
False
# Handle situation when backend did not find the message
if
pounit
is
None
:
...
...
@@ -2561,12 +2561,14 @@ class Unit(models.Model):
messages
.
error
(
request
,
_
(
'Message not found in backend storage, it is probably corrupted.'
))
# Try reloading from backend
self
.
translation
.
update_from_blob
(
True
)
return
return
False
# Return if there was no change
if
not
saved
and
propagate
:
self
.
propagate
(
request
)
return
if
not
saved
:
# Propagate if we should
if
propagate
:
self
.
propagate
(
request
)
return
False
# Update translated flag
self
.
translated
=
is_translated
(
pounit
)
...
...
@@ -2587,40 +2589,44 @@ class Unit(models.Model):
old_translated
=
self
.
translation
.
translated
self
.
translation
.
update_stats
()
if
saved
:
# Notify subscribed users about new translation
subscriptions
=
Profile
.
objects
.
subscribed_any_translation
(
# Notify subscribed users about new translation
subscriptions
=
Profile
.
objects
.
subscribed_any_translation
(
self
.
translation
.
subproject
.
project
,
self
.
translation
.
language
,
request
.
user
)
for
subscription
in
subscriptions
:
subscription
.
notify_any_translation
(
self
,
oldunit
)
# Update user stats
profile
=
request
.
user
.
get_profile
()
profile
.
translated
+=
1
profile
.
save
()
# Notify about new contributor
if
not
Change
.
objects
.
filter
(
translation
=
self
.
translation
,
user
=
request
.
user
).
exists
():
# Get list of subscribers for new contributor
subscriptions
=
Profile
.
objects
.
subscribed_new_contributor
(
self
.
translation
.
subproject
.
project
,
self
.
translation
.
language
,
request
.
user
)
for
subscription
in
subscriptions
:
subscription
.
notify_any_translation
(
self
,
oldunit
)
# Notify about new contributor
if
not
Change
.
objects
.
filter
(
translation
=
self
.
translation
,
user
=
request
.
user
).
exists
():
# Get list of subscribers for new contributor
subscriptions
=
Profile
.
objects
.
subscribed_new_contributor
(
self
.
translation
.
subproject
.
project
,
self
.
translation
.
language
,
request
.
user
)
for
subscription
in
subscriptions
:
subscription
.
notify_new_contributor
(
self
.
translation
,
request
.
user
)
subscription
.
notify_new_contributor
(
self
.
translation
,
request
.
user
)
# Generate Change object for this change
if
gen_change
:
if
oldunit
.
translated
:
action
=
Change
.
ACTION_CHANGE
else
:
action
=
Change
.
ACTION_NEW
# Create change object
Change
.
objects
.
create
(
unit
=
self
,
translation
=
self
.
translation
,
action
=
action
,
user
=
request
.
user
)
# Generate Change object for this change
if
gen_change
:
if
oldunit
.
translated
:
action
=
Change
.
ACTION_CHANGE
else
:
action
=
Change
.
ACTION_NEW
# Create change object
Change
.
objects
.
create
(
unit
=
self
,
translation
=
self
.
translation
,
action
=
action
,
user
=
request
.
user
)
# Force commiting on completing translation
if
old_translated
<
self
.
translation
.
translated
and
self
.
translation
.
translated
==
self
.
translation
.
total
:
...
...
@@ -2635,7 +2641,7 @@ class Unit(models.Model):
if
propagate
:
self
.
propagate
(
request
)
return
saved
return
True
def
save
(
self
,
*
args
,
**
kwargs
):
'''
...
...
weblate/trans/views.py
View file @
11a906ef
...
...
@@ -1362,31 +1362,29 @@ def translate(request, project, subproject, lang):
# Update unit and save it
unit
.
target
=
join_plural
(
form
.
cleaned_data
[
'target'
])
unit
.
fuzzy
=
form
.
cleaned_data
[
'fuzzy'
]
unit
.
save_backend
(
request
)
saved
=
unit
.
save_backend
(
request
)
# 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
.
error
(
request
,
_
(
'Some checks have failed on your translation!'
)
if
saved
:
# Get new set of checks
newchecks
=
set
(
unit
.
active_checks
().
values_list
(
'check'
,
flat
=
True
)
)
# Stay on same entry
return
HttpResponseRedirect
(
'%s?type=%s&pos=%d&dir=stay%s'
%
(
obj
.
get_translate_url
(),
rqtype
,
pos
,
search_url
# Did we introduce any new failures?
if
newchecks
>
oldchecks
:
# Show message to user
messages
.
error
(
request
,
_
(
'Some checks have failed on your translation!'
)
)
# Stay on same entry
return
HttpResponseRedirect
(
'%s?type=%s&pos=%d&dir=stay%s'
%
(
obj
.
get_translate_url
(),
rqtype
,
pos
,
search_url
)
)
)
# Redirect to next entry
return
HttpResponseRedirect
(
'%s?type=%s&pos=%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