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
50e7db36
Commit
50e7db36
authored
Jan 16, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap long lines
parent
57a6f7da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
11 deletions
+62
-11
weblate/trans/management/commands/cleanuptrans.py
weblate/trans/management/commands/cleanuptrans.py
+62
-11
No files found.
weblate/trans/management/commands/cleanuptrans.py
View file @
50e7db36
...
...
@@ -33,35 +33,86 @@ class Command(BaseCommand):
for
prj
in
Project
.
objects
.
all
():
# List all current unit checksums
units
=
Unit
.
objects
.
filter
(
translation__subproject__project
=
prj
).
values
(
'checksum'
).
distinct
()
units
=
Unit
.
objects
.
filter
(
translation__subproject__project
=
prj
).
values
(
'checksum'
).
distinct
()
# Remove source comments referring to deleted units
Comment
.
objects
.
filter
(
language
=
None
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
Comment
.
objects
.
filter
(
language
=
None
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
# Remove source checks referring to deleted units
Check
.
objects
.
filter
(
language
=
None
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
Check
.
objects
.
filter
(
language
=
None
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
for
lang
in
Language
.
objects
.
all
():
# Remove checks referring to deleted or not translated units
translatedunits
=
Unit
.
objects
.
filter
(
translation__language
=
lang
,
translated
=
True
,
translation__subproject__project
=
prj
).
values
(
'checksum'
).
distinct
()
Check
.
objects
.
filter
(
language
=
lang
,
project
=
prj
).
exclude
(
checksum__in
=
translatedunits
).
delete
()
translatedunits
=
Unit
.
objects
.
filter
(
translation__language
=
lang
,
translated
=
True
,
translation__subproject__project
=
prj
).
values
(
'checksum'
).
distinct
()
Check
.
objects
.
filter
(
language
=
lang
,
project
=
prj
).
exclude
(
checksum__in
=
translatedunits
).
delete
()
# List current unit checksums
units
=
Unit
.
objects
.
filter
(
translation__language
=
lang
,
translation__subproject__project
=
prj
).
values
(
'checksum'
).
distinct
()
units
=
Unit
.
objects
.
filter
(
translation__language
=
lang
,
translation__subproject__project
=
prj
).
values
(
'checksum'
).
distinct
()
# Remove suggestions referring to deleted units
Suggestion
.
objects
.
filter
(
language
=
lang
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
Suggestion
.
objects
.
filter
(
language
=
lang
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
# Remove translation comments referring to deleted units
Comment
.
objects
.
filter
(
language
=
lang
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
Comment
.
objects
.
filter
(
language
=
lang
,
project
=
prj
).
exclude
(
checksum__in
=
units
).
delete
()
for
sug
in
Suggestion
.
objects
.
filter
(
language
=
lang
,
project
=
prj
).
iterator
():
# Process suggestions
all_suggestions
=
Suggestion
.
objects
.
filter
(
language
=
lang
,
project
=
prj
)
for
sug
in
all_suggestions
.
iterator
():
# Remove suggestions with same text as real translation
units
=
Unit
.
objects
.
filter
(
checksum
=
sug
.
checksum
,
translation__language
=
lang
,
translation__subproject__project
=
prj
,
target
=
sug
.
target
)
units
=
Unit
.
objects
.
filter
(
checksum
=
sug
.
checksum
,
translation__language
=
lang
,
translation__subproject__project
=
prj
,
target
=
sug
.
target
)
if
units
.
exists
():
sug
.
delete
()
# Remove duplicate suggestions
sugs
=
Suggestion
.
objects
.
filter
(
checksum
=
sug
.
checksum
,
language
=
lang
,
project
=
prj
,
target
=
sug
.
target
).
exclude
(
id
=
sug
.
id
)
sugs
=
Suggestion
.
objects
.
filter
(
checksum
=
sug
.
checksum
,
language
=
lang
,
project
=
prj
,
target
=
sug
.
target
).
exclude
(
id
=
sug
.
id
)
if
sugs
.
exists
():
sugs
.
delete
()
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