Commit ed8a8234 authored by Michal Čihař's avatar Michal Čihař

Added support for merging comments on file upload.

Fixes #874
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 84178043
...@@ -9,6 +9,7 @@ Released on ? 2015. ...@@ -9,6 +9,7 @@ Released on ? 2015.
* Fixed automatic translation for project owners. * Fixed automatic translation for project owners.
* Improved performance of commit and push operations. * Improved performance of commit and push operations.
* New management command to add suggestions from command line. * New management command to add suggestions from command line.
* Added support for merging comments on file upload.
weblate 2.4 weblate 2.4
----------- -----------
......
...@@ -358,6 +358,12 @@ class SimpleUploadForm(forms.Form): ...@@ -358,6 +358,12 @@ class SimpleUploadForm(forms.Form):
required=False, required=False,
initial=True, initial=True,
) )
merge_comments = forms.BooleanField(
label=_('Merge translation comments'),
help_text=_('Merges comments into the translation.'),
required=False,
initial=True,
)
class UploadForm(SimpleUploadForm): class UploadForm(SimpleUploadForm):
......
...@@ -1083,7 +1083,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin): ...@@ -1083,7 +1083,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
return ret return ret
def merge_store(self, request, author, store2, overwrite, merge_header, def merge_store(self, request, author, store2, overwrite, merge_header,
add_fuzzy, fuzzy): add_fuzzy, fuzzy, merge_comments=False):
''' '''
Merges translate-toolkit store into current translation. Merges translate-toolkit store into current translation.
''' '''
...@@ -1116,7 +1116,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin): ...@@ -1116,7 +1116,7 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
continue continue
# Actually update translation # Actually update translation
unit1.merge(unit2.unit, overwrite=True, comments=False) unit1.merge(unit2.unit, overwrite=True, comments=merge_comments)
# Handle # Handle
if add_fuzzy or set_fuzzy: if add_fuzzy or set_fuzzy:
......
...@@ -117,6 +117,7 @@ def upload_translation(request, project, subproject, lang): ...@@ -117,6 +117,7 @@ def upload_translation(request, project, subproject, lang):
overwrite, overwrite,
author, author,
merge_header=form.cleaned_data['merge_header'], merge_header=form.cleaned_data['merge_header'],
merge_comments=form.cleaned_data['merge_comments'],
method=form.cleaned_data['method'], method=form.cleaned_data['method'],
fuzzy=form.cleaned_data['fuzzy'], fuzzy=form.cleaned_data['fuzzy'],
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment