Skip to content

Commit

Permalink
docs: Update documentation on file upload permissions (#11512)
Browse files Browse the repository at this point in the history
* Update documentation of file upload methods with required permissions

Required permissions are checked via check_upload_method_permissions in
/weblate/trans/util.py, and permissions' descriptive labels are defined
in /weblate/auth/data.py

* Add documentation for `approve` file upload method
  • Loading branch information
danimoh committed May 6, 2024
1 parent 1c3fa77 commit 71882b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions docs/user/files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,34 +102,51 @@ Add as translation (``translate``)
the default behavior.

Only translations are used from the uploaded file and no additional content.

This option is available only if the user has the :ref:`"Edit strings" permission <privileges>`.
Add as suggestion (``suggest``)
Imported strings are added as suggestions, do this when you want to have your
Imported strings are added as suggestions. Do this when you want to have your
uploaded strings reviewed.

Only translations are used from the uploaded file and no additional content.

This option is available only if the user has the :ref:`"Add suggestion" permission <privileges>`.
Add as approved translation (``approve``)
Imported strings are added as approved translations. Do this when you already
reviewed your translations before uploading them.

Only translations are used from the uploaded file and no additional content.

This option is available only if the user has the :ref:`"Review strings" permission <privileges>`.
Add as translation needing edit (``fuzzy``)
Imported strings are added as translations needing edit. This can be useful
when you want translations to be used, but also reviewed.

Only translations are used from the uploaded file and no additional content.

This option is available only if the user has the :ref:`"Edit strings" permission <privileges>`.
Replace existing translation file (``replace``)
Existing file is replaced with new content. This can lead to loss of existing
translations, use with caution.

This option is available only if the user has the :ref:`"Edit component settings" permission <privileges>`.
Update source strings (``source``)
Updates source strings in bilingual translation file. This is similar to
what :ref:`addon-weblate.gettext.msgmerge` does.

This option is supported only for some file formats.
This option is available only for some file formats and only if the user has the
:ref:`"Upload translations" permission <privileges>`.
Add new strings (``add``)
Adds new strings to the translation. It skips the one which already exist.

In case you want to both add new strings and update existing translations,
upload the file second time with :guilabel:`Add as translation`.

This option is available only with :ref:`component-manage_units` turned on.

Only source, translation and key (context) are used from the uploaded file.

This option is available only with :ref:`component-manage_units` turned on
and only if the user has the :ref:`"Add new string" permission <privileges>`.

.. seealso::

:http:post:`/api/translations/(string:project)/(string:component)/(string:language)/file/`
Expand Down
2 changes: 1 addition & 1 deletion weblate/trans/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def get_field_doc(field):
return ("user/files", f"upload-{field.name}")

def remove_translation_choice(self, value) -> None:
"""Remove "Add as translation" choice."""
"""Remove given file upload method from choices."""
choices = self.fields["method"].choices
self.fields["method"].choices = [
choice for choice in choices if choice[0] != value
Expand Down

0 comments on commit 71882b4

Please sign in to comment.