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
b3eb204c
Commit
b3eb204c
authored
Apr 08, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use fancy progressbars for languages (issue #196)
parent
9cb42cda
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
lang/models.py
lang/models.py
+42
-0
weblate/html/languages.html
weblate/html/languages.html
+2
-2
No files found.
lang/models.py
View file @
b3eb204c
...
...
@@ -398,6 +398,48 @@ class Language(models.Model):
return
0
return
round
(
translated
*
100.0
/
total
,
1
)
def
get_fuzzy_percent
(
self
):
'''
Returns status of translations in this language.
'''
from
trans.models
import
Translation
translations
=
Translation
.
objects
.
filter
(
language
=
self
).
aggregate
(
Sum
(
'fuzzy'
),
Sum
(
'total'
)
)
fuzzy
=
translations
[
'fuzzy__sum'
]
total
=
translations
[
'total__sum'
]
# Prevent division by zero on no translations
if
total
==
0
:
return
0
return
round
(
fuzzy
*
100.0
/
total
,
1
)
def
get_failing_checks_percent
(
self
):
'''
Returns status of translations in this language.
'''
from
trans.models
import
Translation
translations
=
Translation
.
objects
.
filter
(
language
=
self
).
aggregate
(
Sum
(
'failing_checks'
),
Sum
(
'total'
)
)
failing_checks
=
translations
[
'failing_checks__sum'
]
total
=
translations
[
'total__sum'
]
# Prevent division by zero on no translations
if
total
==
0
:
return
0
return
round
(
failing_checks
*
100.0
/
total
,
1
)
def
get_html
(
self
):
'''
Returns html attributes for markup in this language, includes
...
...
weblate/html/languages.html
View file @
b3eb204c
...
...
@@ -16,10 +16,10 @@
</tr>
<tbody>
{% for lang in languages %}
{% with lang.get_translated_percent as percent %}
{% with lang.get_translated_percent as percent
and lang.get_fuzzy_percent as fuzzy and lang.get_failing_checks_percent as check_percent
%}
<tr>
<th><a
href=
"{{ lang.get_absolute_url }}"
>
{{ lang }}
</a></th>
<td><div
class=
"progress"
data-value=
"{{ percent|floatformat:0 }}"
></div></td>
<td><div
class=
"progress"
data-value=
"{{ percent|floatformat:0 }}"
data-fuzzy=
"{{ fuzzy|floatformat:0 }}"
data-checks=
"{{ check_percent|floatformat:0 }}"
></div></td>
<td
class=
"percent"
>
{{ percent }}%
</td>
</tr>
{% endwith %}
...
...
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