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

[RestAPI] How to add translation to already created key? #9073

Closed
2 tasks done
infureal opened this issue Apr 12, 2023 · 3 comments · Fixed by #9097
Closed
2 tasks done

[RestAPI] How to add translation to already created key? #9073

infureal opened this issue Apr 12, 2023 · 3 comments · Fixed by #9097
Assignees
Labels
enhancement Adding or requesting a new feature.
Milestone

Comments

@infureal
Copy link

infureal commented Apr 12, 2023

Describe the issue

In documentation I find /api/translations/(string:project)/(string:component)/(string:language)/units/ endpoit that create a new unit. For example with ru language code. Next I try to create translation to this key by using same endpoint but another language code kk. But I got 403 Forbidden message:

{
    "detail": "Can not add unit"
}

Question: How can I add transation to created unit via RestAPI.

I already tried

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

Steps to reproduce the behavior

  1. Add translation to key for language via /api/translations/(string:project)/(string:component)/(string:language)/units/
  2. ...

Expected behavior

To create translation for existing unit

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

PyPI module

Weblate versions

No response

Weblate deploy checks

No response

Additional context

No response

@infureal infureal added the question This is more a question for the support than an issue. label Apr 12, 2023
@github-actions
Copy link

This issue looks more like a support question than an issue. We strive to answer these reasonably fast, but purchasing the support subscription is not only more responsible and faster for your business but also makes Weblate stronger.

In case your question is already answered, making a donation is the right way to say thank you!

@Dmytro9999
Copy link

Dmytro9999 commented Apr 13, 2023

I had the same problem today

{
  "detail": "Can not add unit"
}
Status: 403 Forbidden

I'm trying to add new unit translation via rest api but I receive status 403 and info can not add unit.

I do POST /api/translations/(string: project)/(string: component)/(string: language)/units/ with my token. and body:

{ "key": "somekey", "value": ["some value"] }

I can add translation unit via admin panel but when i try do this programatically i get response as described.
Could someone help me to resolve this issue ?

@nijel nijel added enhancement Adding or requesting a new feature. and removed question This is more a question for the support than an issue. labels Apr 17, 2023
@nijel nijel self-assigned this Apr 17, 2023
@nijel nijel added this to To do in API improvements via automation Apr 17, 2023
@nijel nijel modified the milestones: 4.17, 4.17.1, 4.18 Apr 17, 2023
nijel added a commit to nijel/weblate that referenced this issue Apr 17, 2023
- This moves the logic to single place instead of duplicating it in the
  template to get the verbose message.
- The detailed message is now used in the API as well.

Fixes WeblateOrg#9073
nijel added a commit to nijel/weblate that referenced this issue Apr 17, 2023
- This moves the logic to single place instead of duplicating it in the
  template to get the verbose message.
- The detailed message is now used in the API as well.

Fixes WeblateOrg#9073
API improvements automation moved this from To do to Done Apr 17, 2023
nijel added a commit that referenced this issue Apr 17, 2023
- This moves the logic to single place instead of duplicating it in the
  template to get the verbose message.
- The detailed message is now used in the API as well.

Fixes #9073
@github-actions
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
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants