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
e65e12d7
Commit
e65e12d7
authored
Apr 16, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show current filter (issue #30)
parent
7827e982
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
18 deletions
+22
-18
html/translate.html
html/translate.html
+4
-0
trans/managers.py
trans/managers.py
+0
-18
trans/views.py
trans/views.py
+18
-0
No files found.
html/translate.html
View file @
e65e12d7
...
...
@@ -23,9 +23,13 @@
</span>
</p>
{% if filter_name %}
<p>
{% blocktrans %}Current filter: {{ filter_name }}{% endblocktrans %}
</p>
{% else %}
{% if search_query %}
<p>
{% blocktrans %}Searching for "{{ search_query }}".{% endblocktrans %}
</p>
{% endif %}
{% endif %}
<form
action=
"{{ unit.translation.get_translate_url }}"
method=
"post"
>
{% csrf_token %}
...
...
trans/managers.py
View file @
e65e12d7
...
...
@@ -120,24 +120,6 @@ class UnitManager(models.Manager):
dbunit
.
update_from_unit
(
unit
,
pos
,
force
)
return
dbunit
def
filter_name
(
self
,
rqtype
):
'''
Returns name of current filter.
'''
import
trans.checks
if
rqtype
==
'all'
:
return
None
elif
rqtype
==
'fuzzy'
:
return
_
(
'Fuzzy strings'
)
elif
rqtype
==
'untranslated'
:
return
_
(
'Not translated strings'
)
elif
rqtype
==
'suggestions'
:
return
_
(
'Strings with suggestions'
)
elif
rqtype
in
trans
.
checks
.
CHECKS
:
return
trans
.
checks
.
CHECKS
[
rqtype
].
name
else
:
return
None
def
filter_type
(
self
,
rqtype
):
'''
Basic filtering based on unit state or failed checks.
...
...
trans/views.py
View file @
e65e12d7
...
...
@@ -520,6 +520,23 @@ def parse_search_url(request):
search_url
)
def
get_filter_name
(
rqtype
):
'''
Returns name of current filter.
'''
if
rqtype
==
'all'
:
return
None
elif
rqtype
==
'fuzzy'
:
return
_
(
'Fuzzy strings'
)
elif
rqtype
==
'untranslated'
:
return
_
(
'Not translated strings'
)
elif
rqtype
==
'suggestions'
:
return
_
(
'Strings with suggestions'
)
elif
rqtype
in
trans
.
checks
.
CHECKS
:
return
trans
.
checks
.
CHECKS
[
rqtype
].
name
else
:
return
None
def
translate
(
request
,
project
,
subproject
,
lang
):
obj
=
get_object_or_404
(
Translation
,
language__code
=
lang
,
subproject__slug
=
subproject
,
subproject__project__slug
=
project
)
...
...
@@ -789,6 +806,7 @@ def translate(request, project, subproject, lang):
'changes'
:
unit
.
change_set
.
all
()[:
10
],
'total'
:
total
,
'type'
:
rqtype
,
'filter_name'
:
get_filter_name
(
rqtype
),
'form'
:
form
,
'target_language'
:
obj
.
language
.
code
,
'secondary'
:
secondary
,
...
...
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