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

Define state of the unit on create via API #7601

Closed
antonkomarev opened this issue May 6, 2022 · 9 comments · Fixed by #8838
Closed

Define state of the unit on create via API #7601

antonkomarev opened this issue May 6, 2022 · 9 comments · Fixed by #8838
Labels
enhancement Adding or requesting a new feature. good first issue Opportunity for newcoming contributors. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed.
Milestone

Comments

@antonkomarev
Copy link

Describe the problem

It would be greate to have a way to define state of the unit on creation via an API.
If we will do it in 2 steps (1 — create unit, 2 — patch unit state), there may be an issue with data consistency. For example 1st request is done, but on second there will be network issue, or requester server has died unexpectedly.

POST /api/translations/(string: project)/(string: component)/(string: language)/units/

{
    "key": "example_key",
    "value": ["Example translation"]
}

Describe the solution you'd like

POST /api/translations/(string: project)/(string: component)/(string: language)/units/

{
    "key": "example_key",
    "value": ["Example translation"],
    "state": 10 // Needs editing
}

Describe alternatives you've considered

No response

Screenshots

No response

Additional context

No response

@nijel nijel added enhancement Adding or requesting a new feature. help wanted Extra attention is needed. good first issue Opportunity for newcoming contributors. labels May 6, 2022
@nijel nijel added this to To do in API improvements via automation May 6, 2022
@github-actions
Copy link

github-actions bot commented May 6, 2022

This issue seems to be a good fit for newbie contributors. You are welcome to contribute to Weblate! Don't hesitate to ask any questions you would have while implementing this.

You can learn about how to get started in our contributors documentation.

@scott-gorman
Copy link

Hey, i'd like to work on this!

@nijel
Copy link
Member

nijel commented May 6, 2022

You are welcome. In case you need any guidance don't hesitate to ask.

@antonkomarev
Copy link
Author

@scott-gorman any progress on it?

@nijel nijel added the hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. label Sep 19, 2022
@rhofer
Copy link
Contributor

rhofer commented Nov 16, 2022

It would also be good to extend the API for GETting a translation. This together with writing POST the state would be great for roundtrip needs.

Example:
We need to boldly work on translation keys. Therefore, old key with old value should go to new key with old value. Just doing this in the connected repository is working, but weblate is loosing the previous translation state. Therefore, we would be happy to use the API in away so that

  1. GET (all) units with its state (-> do it with API)
  2. copy over and create new keys with old values (-> could be done in connected repo (as-is))
  3. POST (all) units' former states forward to the new keys (with old values) (-> do it with API)
  4. removing old key value pairs (-> could be done in connected repo (as-is))

@scott-gorman could you consider this when workin on API extension?

@rhofer
Copy link
Contributor

rhofer commented Nov 16, 2022

@nijel with my example described in #7601 (comment) above, this only addresses "meta data" as the state. But when doing such operations as mentioned, it would be good to act on further "meta data" as suggestions and comments , so that potentially API would allow to act on them as well.

Would this fit to this issue or shall I write a new one?

@nijel
Copy link
Member

nijel commented Nov 21, 2022

@rhofer Please open separate issue for each of these.

@nijel nijel added this to the 4.16 milestone Nov 21, 2022
nijel added a commit to nijel/weblate that referenced this issue Feb 27, 2023
API improvements automation moved this from To do to Done Feb 27, 2023
@antonkomarev
Copy link
Author

@nijel thank you!

@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. good first issue Opportunity for newcoming contributors. hacktoberfest This is suitable for Hacktoberfest. Don’t try to spam. help wanted Extra attention is needed.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants