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
39d35f1d
Commit
39d35f1d
authored
Jan 14, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for automatic translation across projects
Fixes #969 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
fbfe1005
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
7 deletions
+17
-7
docs/changes.rst
docs/changes.rst
+1
-0
weblate/trans/forms.py
weblate/trans/forms.py
+14
-5
weblate/trans/views/basic.py
weblate/trans/views/basic.py
+1
-1
weblate/trans/views/edit.py
weblate/trans/views/edit.py
+1
-1
No files found.
docs/changes.rst
View file @
39d35f1d
...
...
@@ -25,6 +25,7 @@ Released on ? 2015.
* Improved support for XLIFF files.
* Extended list of options for import_project.
* Improved targeting for whiteboard messages.
* Support for automatic translation across projects.
weblate 2.4
-----------
...
...
weblate/trans/forms.py
View file @
39d35f1d
...
...
@@ -624,21 +624,30 @@ class AutoForm(forms.Form):
initial
=
''
)
def
__init__
(
self
,
obj
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
obj
,
user
,
*
args
,
**
kwargs
):
'''
Dynamically generate choices for other subproject
in same project
'''
project
=
obj
.
subproject
.
project
other_subprojects
=
project
.
subproject_set
.
exclude
(
other_subprojects
=
obj
.
subproject
.
project
.
subproject_set
.
exclude
(
id
=
obj
.
subproject
.
id
)
choices
=
[(
s
.
id
,
s
.
name
)
for
s
in
other_subprojects
]
choices
=
[(
s
.
id
,
force_text
(
s
))
for
s
in
other_subprojects
]
# Add other owned projects
owned_projects
=
user
.
project_set
.
all
().
exclude
(
pk
=
obj
.
subproject
.
project
.
id
)
for
project
in
owned_projects
:
for
component
in
project
.
subproject_set
.
all
():
choices
.
add
(
(
component
.
id
,
force_text
(
component
))
)
super
(
AutoForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'subproject'
].
choices
=
\
[(
''
,
_
(
'All components'
))]
+
choices
[(
''
,
_
(
'All components
in current project
'
))]
+
choices
class
WordForm
(
forms
.
Form
):
...
...
weblate/trans/views/basic.py
View file @
39d35f1d
...
...
@@ -289,7 +289,7 @@ def show_translation(request, project, subproject, lang):
# Is user allowed to do automatic translation?
if
can_automatic_translation
(
request
.
user
,
obj
.
subproject
.
project
):
autoform
=
AutoForm
(
obj
)
autoform
=
AutoForm
(
obj
,
request
.
user
)
else
:
autoform
=
None
...
...
weblate/trans/views/edit.py
View file @
39d35f1d
...
...
@@ -606,7 +606,7 @@ def auto_translation(request, project, subproject, lang):
raise
PermissionDenied
()
translation
.
commit_pending
(
request
)
autoform
=
AutoForm
(
translation
,
request
.
POST
)
autoform
=
AutoForm
(
translation
,
request
.
user
,
request
.
POST
)
change
=
None
if
not
translation
.
subproject
.
locked
and
autoform
.
is_valid
():
if
autoform
.
cleaned_data
[
'inconsistent'
]:
...
...
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