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
ac4fbf6e
Commit
ac4fbf6e
authored
Feb 01, 2016
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
5695aa53
9937cf64
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
104 deletions
+133
-104
docs/changes.rst
docs/changes.rst
+1
-0
weblate/html/translation.html
weblate/html/translation.html
+1
-1
weblate/trans/checklists.py
weblate/trans/checklists.py
+35
-0
weblate/trans/models/translation.py
weblate/trans/models/translation.py
+94
-103
weblate/trans/models/unit.py
weblate/trans/models/unit.py
+2
-0
No files found.
docs/changes.rst
View file @
ac4fbf6e
...
...
@@ -34,6 +34,7 @@ Released on ? 2015.
* Added quality check for AngularJS interpolation.
* Added extensive group based ACLs.
* Clarified terminology on strings needing review (formerly fuzzy).
* Clarified terminology on strings needing action and not translated strings.
weblate 2.4
-----------
...
...
weblate/html/translation.html
View file @
ac4fbf6e
...
...
@@ -116,7 +116,7 @@
<div
class=
"panel-body"
>
<div
class=
"list-group"
>
{% for c in object.get_translation_checks %}
<a
class=
"list-group-item list-group-item-{{ c.3 }}"
href=
"{{ object.get_translate_url }}?type={{ c.0 }}"
><span
class=
"badge"
>
{{ c.2 }}
</span>
{{ c.1 }}
</a>
<a
class=
"list-group-item list-group-item-{{ c.3 }}"
href=
"{{ object.get_translate_url }}?type={{ c.0 }}"
>
{% if c.4 %}
<span
class=
"badge"
>
{% blocktrans count c.4 as count %}{{ count }} word{% plural %}{{ count }} words{% endblocktrans %}
</span>
{% endif %}
<span
class=
"badge"
>
{{ c.2 }}
</span>
{{ c.1 }}
</a>
{% endfor %}
</div>
</div>
...
...
weblate/trans/checklists.py
0 → 100644
View file @
ac4fbf6e
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
class
TranslationChecklist
(
list
):
"""Simple list wrapper for translation checklist"""
def
add_if
(
self
,
name
,
label
,
count
,
level
,
words
=
None
):
"""Add to list if there are matches"""
if
count
>
0
:
self
.
add
(
name
,
label
,
count
,
level
,
words
)
def
add
(
self
,
name
,
label
,
count
,
level
,
words
=
None
):
"""Adds item to the list"""
if
words
is
not
None
:
self
.
append
((
name
,
label
,
count
,
level
,
words
))
else
:
self
.
append
((
name
,
label
,
count
,
level
))
weblate/trans/models/translation.py
View file @
ac4fbf6e
...
...
@@ -47,6 +47,7 @@ from weblate.trans.mixins import URLMixin, PercentMixin, LoggerMixin
from
weblate.trans.boolean_sum
import
BooleanSum
from
weblate.accounts.models
import
notify_new_string
,
get_author_name
from
weblate.trans.models.changes
import
Change
from
weblate.trans.checklists
import
TranslationChecklist
class
TranslationManager
(
models
.
Manager
):
...
...
@@ -926,47 +927,41 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
'''
Returns list of failing source checks on current subproject.
'''
result
=
[
(
'all'
,
_
(
'All strings'
),
self
.
total
,
'success'
,
)
]
result
=
TranslationChecklist
()
result
.
add
(
'all'
,
_
(
'All strings'
),
self
.
total
,
'success'
,
)
# All checks
sourcechecks
=
self
.
unit_set
.
count_type
(
'sourcechecks'
,
self
)
if
sourcechecks
>
0
:
result
.
append
((
'sourcechecks'
,
_
(
'Strings with any failing checks'
),
sourcechecks
,
'danger'
,
))
result
.
add_if
(
'sourcechecks'
,
_
(
'Strings with any failing checks'
),
self
.
unit_set
.
count_type
(
'sourcechecks'
,
self
),
'danger'
,
)
# Process specific checks
for
check
in
CHECKS
:
if
not
CHECKS
[
check
].
source
:
check_obj
=
CHECKS
[
check
]
if
not
check_obj
.
source
:
continue
cnt
=
self
.
unit_set
.
count_type
(
check
,
self
)
if
cnt
>
0
:
result
.
append
((
check
,
CHECKS
[
check
].
description
,
cnt
,
CHECKS
[
check
].
severity
,
))
result
.
add_if
(
check
,
check_obj
.
description
,
self
.
unit_set
.
count_type
(
check
,
self
),
check_obj
.
severity
,
)
# Grab comments
sourcecomments
=
self
.
unit_set
.
count_type
(
'sourcecomments'
,
self
)
if
sourcecomments
>
0
:
result
.
append
((
'sourcecomments'
,
_
(
'Strings with comments'
),
sourcecomments
,
'info'
,
))
result
.
add_if
(
'sourcecomments'
,
_
(
'Strings with comments'
),
self
.
unit_set
.
count_type
(
'sourcecomments'
,
self
),
'info'
,
)
return
result
...
...
@@ -974,92 +969,88 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
'''
Returns list of failing checks on current translation.
'''
result
=
[
(
'all'
,
_
(
'All strings'
),
self
.
total
,
'success'
,
)
]
result
=
TranslationChecklist
()
# All strings
result
.
add
(
'all'
,
_
(
'All strings'
),
self
.
total
,
'success'
,
self
.
total_words
)
# Count of translated strings
if
self
.
translated
>
0
:
result
.
append
((
'translated'
,
_
(
'Translated strings'
),
self
.
translated
,
'success'
,
))
result
.
add_if
(
'translated'
,
_
(
'Translated strings'
),
self
.
translated
,
'success'
,
self
.
translated_words
,
)
# Not translated strings
result
.
add_if
(
'nottranslated'
,
_
(
'Not translated strings'
),
self
.
total
-
self
.
translated
-
self
.
fuzzy
,
'danger'
,
self
.
total_words
-
self
.
translated_words
-
self
.
fuzzy_words
,
)
# Untranslated strings
nottranslated
=
self
.
total
-
self
.
translated
if
nottranslated
>
0
:
result
.
append
((
'untranslated'
,
_
(
'Untranslated strings'
),
nottranslated
,
'danger'
,
))
# Untranslated words, the link is same, just to show number of words
nottranslated
=
self
.
total_words
-
self
.
translated_words
if
nottranslated
>
0
:
result
.
append
((
'untranslated'
,
_
(
'Untranslated words'
),
nottranslated
,
'danger'
,
))
result
.
add_if
(
'todo'
,
_
(
'Strings needing attention'
),
self
.
total
-
self
.
translated
,
'danger'
,
self
.
total_words
-
self
.
translated_words
,
)
# Fuzzy strings
if
self
.
fuzzy
>
0
:
result
.
append
((
'fuzzy'
,
_
(
'Strings needing review'
)
,
self
.
fuzzy
,
'danger'
,
)
)
result
.
add_if
(
'fuzzy'
,
_
(
'Strings needing review'
)
,
self
.
fuzzy
,
'danger'
,
self
.
fuzzy_words
,
)
# Translations with suggestions
if
self
.
have_suggestion
>
0
:
result
.
append
((
'suggestions'
,
_
(
'Strings with suggestions'
),
self
.
have_suggestion
,
'info'
,
))
result
.
add_if
(
'suggestions'
,
_
(
'Strings with suggestions'
),
self
.
have_suggestion
,
'info'
,
)
# All checks
if
self
.
failing_checks
>
0
:
result
.
append
((
'allchecks'
,
_
(
'Strings with any failing checks'
),
self
.
failing_checks
,
'danger'
,
))
result
.
add_if
(
'allchecks'
,
_
(
'Strings with any failing checks'
),
self
.
failing_checks
,
'danger'
,
)
# Process specific checks
for
check
in
CHECKS
:
if
not
CHECKS
[
check
].
target
:
check_obj
=
CHECKS
[
check
]
if
not
check_obj
.
target
:
continue
cnt
=
self
.
unit_set
.
count_type
(
check
,
self
)
if
cnt
>
0
:
result
.
append
((
check
,
CHECKS
[
check
].
description
,
cnt
,
CHECKS
[
check
].
severity
,
))
result
.
add_if
(
check
,
check_obj
.
description
,
self
.
unit_set
.
count_type
(
check
,
self
),
check_obj
.
severity
,
)
# Grab comments
if
self
.
have_comment
>
0
:
result
.
append
((
'comments'
,
_
(
'Strings with comments'
),
self
.
have_comment
,
'info'
,
))
result
.
add_if
(
'comments'
,
_
(
'Strings with comments'
),
self
.
have_comment
,
'info'
,
)
return
result
...
...
weblate/trans/models/unit.py
View file @
ac4fbf6e
...
...
@@ -50,6 +50,8 @@ from weblate.trans.util import (
SIMPLE_FILTERS
=
{
'fuzzy'
:
{
'fuzzy'
:
True
},
'untranslated'
:
{
'translated'
:
False
},
'todo'
:
{
'translated'
:
False
},
'nottranslated'
:
{
'translated'
:
False
,
'fuzzy'
:
False
},
'translated'
:
{
'translated'
:
True
},
'suggestions'
:
{
'has_suggestion'
:
True
},
'comments'
:
{
'has_comment'
:
True
},
...
...
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