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
dbaa8195
Commit
dbaa8195
authored
Aug 18, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for adding words to dictionary while translating
Fixes #675 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
808ad745
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
6 deletions
+33
-6
docs/changes.rst
docs/changes.rst
+1
-0
weblate/html/translate.html
weblate/html/translate.html
+18
-4
weblate/trans/forms.py
weblate/trans/forms.py
+9
-0
weblate/trans/views/dictionary.py
weblate/trans/views/dictionary.py
+3
-1
weblate/trans/views/edit.py
weblate/trans/views/edit.py
+2
-1
No files found.
docs/changes.rst
View file @
dbaa8195
...
...
@@ -26,6 +26,7 @@ Released on ? 2015.
* Extended keyboard shortcuts.
* Improved dictionary matching for several languages.
* Improved layout of most of pages.
* Support for adding words to dictionary while translating.
weblate 2.3
-----------
...
...
weblate/html/translate.html
View file @
dbaa8195
...
...
@@ -333,7 +333,9 @@
</h4>
</div>
<div
class=
"panel-body"
>
{% if glossary %}
<form
action=
"{% url 'show_dictionary' project=unit.translation.subproject.project.slug lang=unit.translation.language.code %}"
method=
"POST"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"next"
value=
"{{ this_unit_url }}"
/>
<table
class=
"table table-condensed table-striped"
>
<thead>
<tr>
...
...
@@ -353,12 +355,24 @@
{% endif %}
</td>
</tr>
{% empty %}
<tr>
<td
colspan=
"3"
>
{% trans "No related strings were found in the glossary." %}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr
class=
"form-inline"
>
<td>
{{ addword_form.source }}
</td>
<td>
{{ addword_form.target }}
</td>
<td>
<input
type=
"submit"
class=
"btn btn-default btn-xs"
title=
"{% trans "
Add
word
to
glossary
"
%}"
value=
"{% trans "
Add
"
%}"
/>
<td>
</tfoot>
</table>
{% else %}
<p>
{% trans "No related strings were found in the glossary." %}
</p>
{% endif %}
</form>
</div>
</div>
...
...
weblate/trans/forms.py
View file @
dbaa8195
...
...
@@ -605,6 +605,15 @@ class WordForm(forms.Form):
target
=
forms
.
CharField
(
label
=
_
(
'Translation'
))
class
InlineWordForm
(
WordForm
):
"""Inline rendered form for adding words."""
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
InlineWordForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
for
field
in
(
'source'
,
'target'
):
self
.
fields
[
field
].
widget
.
attrs
[
'placeholder'
]
=
self
.
fields
[
field
].
label
self
.
fields
[
field
].
widget
.
attrs
[
'size'
]
=
10
class
DictUploadForm
(
forms
.
Form
):
'''
Uploading file to a dictionary.
...
...
weblate/trans/views/dictionary.py
View file @
dbaa8195
...
...
@@ -295,7 +295,9 @@ def show_dictionary(request, project, lang):
source
=
form
.
cleaned_data
[
'source'
],
target
=
form
.
cleaned_data
[
'target'
]
)
return
HttpResponseRedirect
(
request
.
get_full_path
())
return
HttpResponseRedirect
(
request
.
POST
.
get
(
'next'
,
request
.
get_full_path
())
)
else
:
form
=
WordForm
()
...
...
weblate/trans/views/edit.py
View file @
dbaa8195
...
...
@@ -35,7 +35,7 @@ from weblate.trans.models import (
)
from
weblate.trans.autofixes
import
fix_target
from
weblate.trans.forms
import
(
TranslationForm
,
SearchForm
,
TranslationForm
,
SearchForm
,
InlineWordForm
,
MergeForm
,
AutoForm
,
ReviewForm
,
AntispamForm
,
CommentForm
,
RevertForm
)
...
...
@@ -594,6 +594,7 @@ def translate(request, project, subproject, lang):
'user_locked'
:
user_locked
,
'project_locked'
:
project_locked
,
'glossary'
:
Dictionary
.
objects
.
get_words
(
unit
),
'addword_form'
:
InlineWordForm
(),
}
)
...
...
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