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
f7c156b3
Commit
f7c156b3
authored
Mar 01, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store absolute numbers of messages rather than percent
parent
8ec07f4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
html/subproject.html
html/subproject.html
+2
-2
html/translation_info.html
html/translation_info.html
+1
-1
trans/models.py
trans/models.py
+14
-8
No files found.
html/subproject.html
View file @
f7c156b3
...
...
@@ -15,11 +15,11 @@
{% for trans in object.translation_set.all %}
<li><a
href=
"{{ trans.get_absolute_url }}"
>
{{ trans.language.name }}
{% if trans.fuzzy %}
{% blocktrans with trans.
translated as translated and trans.fuzzy
as fuzzy %}
{% blocktrans with trans.
get_translated_percent as translated and trans.get_fuzzy_percent
as fuzzy %}
({{ translated }}% translated, {{ fuzzy }}% fuzzy)
{% endblocktrans %}
{% else %}
{% blocktrans with trans.
translated
as translated %}
{% blocktrans with trans.
get_translated_percent
as translated %}
({{ translated }}% translated)
{% endblocktrans %}
{% endif %}
...
...
html/translation_info.html
View file @
f7c156b3
...
...
@@ -4,7 +4,7 @@
{% include "subproject_info.html" %}
{% endwith %}
<p>
{% blocktrans with object.unit_set.all.count as count and object.
translated as translated and object.fuzzy
as fuzzy %}
{% blocktrans with object.unit_set.all.count as count and object.
get_translated_percent as translated and object.get_fuzzy_percent
as fuzzy %}
There are {{ count }} strings, out of which {{ translated }}% is translated
and {{ fuzzy }}% is fuzzy.
{% endblocktrans %}
...
...
trans/models.py
View file @
f7c156b3
...
...
@@ -176,16 +176,24 @@ class SubProject(models.Model):
class
Translation
(
models
.
Model
):
subproject
=
models
.
ForeignKey
(
SubProject
)
language
=
models
.
ForeignKey
(
Language
)
translated
=
models
.
FloatField
(
default
=
0
,
db_index
=
True
)
fuzzy
=
models
.
FloatField
(
default
=
0
,
db_index
=
True
)
revision
=
models
.
CharField
(
max_length
=
40
,
default
=
''
,
blank
=
True
)
filename
=
models
.
CharField
(
max_length
=
200
)
filename
=
models
.
CharField
(
max_length
=
200
)
\
translated
=
models
.
IntegerField
(
default
=
0
,
db_index
=
True
)
fuzzy
=
models
.
IntegerField
(
default
=
0
,
db_index
=
True
)
total
=
models
.
IntegerField
(
default
=
0
,
db_index
=
True
)
objects
=
TranslationManager
()
class
Meta
:
ordering
=
[
'language__name'
]
def
get_fuzzy_percent
(
self
):
return
round
(
self
.
fuzzy
*
100.0
/
self
.
total
,
1
)
def
get_translated_percent
(
self
):
return
round
(
self
.
translated
*
100.0
/
self
.
total
,
1
)
@
models
.
permalink
def
get_absolute_url
(
self
):
return
(
'trans.views.show_translation'
,
(),
{
...
...
@@ -255,11 +263,9 @@ class Translation(models.Model):
def
update_stats
(
self
,
blob
=
None
):
if
blob
is
None
:
blob
=
self
.
get_git_blob
()
total
=
self
.
unit_set
.
count
()
fuzzy
=
self
.
unit_set
.
filter
(
fuzzy
=
True
).
count
()
translated
=
self
.
unit_set
.
filter
(
translated
=
True
).
count
()
self
.
fuzzy
=
round
(
fuzzy
*
100.0
/
total
,
1
)
self
.
translated
=
round
(
translated
*
100.0
/
total
,
1
)
self
.
total
=
self
.
unit_set
.
count
()
self
.
fuzzy
=
self
.
unit_set
.
filter
(
fuzzy
=
True
).
count
()
self
.
translated
=
self
.
unit_set
.
filter
(
translated
=
True
).
count
()
self
.
revision
=
blob
.
hexsha
self
.
save
()
...
...
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