Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear error message on replacing source language's translation file through API #10841

Closed
2 tasks done
exhilaratedguy opened this issue Jan 23, 2024 · 3 comments · Fixed by #10846
Closed
2 tasks done
Assignees
Labels
enhancement Adding or requesting a new feature.
Milestone

Comments

@exhilaratedguy
Copy link

Describe the issue

Using Weblate v4.17, I am trying to fully replace the translation file for the source language of my translation component through Weblate's API. This works fine for other languages, but errors out for the source language with the error message "You can not overwrite existing approved translations".

I'm confused as to why this is the case through the API, since uploading a file through the web portal with "Replace existing translation file" works without a hitch.

For reference, here is a code snippet of the request:

axios({
    url: `${process.env.REACT_APP_WEBLATE_URL}api/translations/${process.env.REACT_APP_WEBLATE_PATH}${language}/file/`,
    method: "POST",
    data: {
      file: fs.createReadStream(filePath),
      email: "[email protected]",
      author: "Author name",
      conflicts: "replace-approved",
      method: "replace",
    },
    headers: {
      "Content-Type": "multipart/form-data",
      Authorization: `Token ${process.env.REACT_APP_WEBLATE_TOKEN}`,
    },
  })

I have searched extensively on the docs, google and the issues on GitHub, but found no mentions about this issue.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. Add a new translation component
  2. Make a POST request to /api/translations/(string: project)/(string: component)/(string: language)/file/ for the source language
  3. Error - "You can not overwrite existing approved translations"

Expected behavior

Translation file successfully replace

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

Other

Weblate versions

No response

Weblate deploy checks

No response

Additional context

No response

@nijel
Copy link
Member

nijel commented Jan 24, 2024

Most likely source strings review are not enabled and thus approved state is not applicable. The error message could be definitely more clear in this case.

@nijel nijel self-assigned this Jan 24, 2024
@nijel nijel added the enhancement Adding or requesting a new feature. label Jan 24, 2024
@nijel nijel added this to the 5.4 milestone Jan 24, 2024
@nijel nijel changed the title Failing to replace source language's translation file through API Unclear error message on replacing source language's translation file through API Jan 24, 2024
@exhilaratedguy
Copy link
Author

exhilaratedguy commented Jan 24, 2024

@nijel Thanks for the quick reply. Can you point me to the right screen to update the necessary permissions for this?

I've found it! Thank you!

Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants