weblate icon indicating copy to clipboard operation
weblate copied to clipboard

Screenshot link for units (API)

Open bilalcorbacioglu opened this issue 4 years ago • 8 comments

Hello everybody,

I use the Weblate API for the external recording app. In the project, sometimes Voice Over artist wants to see the screenshot before the recording. I am already using the "Screenshot feature" in the Weblate. But we can not take the screenshots links special for the units via API. So, it can be nice to see a screenshot_link field for these endpoints;

/api/translations/PROJECT/COMPONENT/LANGUAGE/units/ /api/units/UNIT_ID

Thanks!

bilalcorbacioglu avatar May 25 '21 12:05 bilalcorbacioglu

A desired solution would be to add screenshots link field to the UnitSerializer class. In addition to listing existing screenshots, it should support adding and deleting screenshot assignments via POST and DELETE methods. Please note that adding should do additional validation that the screenshot is for matching component and language. All functionality should be covered by the tests and documentation.

UnitSerializer class is located here:

https://github.com/WeblateOrg/weblate/blob/d44e18f7c68ce313c3a7bb9646791fbf4921cbc5/weblate/api/serializers.py#L908-L959

nijel avatar May 05 '22 08:05 nijel

Hey @nijel, I was setting up the project locally, and everything went great. Though I do have one doubt. Do we have some test data by which I can populate the db and pace up my work on this?

prateekj117 avatar May 05 '22 14:05 prateekj117

Yes, see https://docs.weblate.org/en/latest/contributing/start.html#bootstrapping-your-devel-instance

nijel avatar May 05 '22 14:05 nijel

@nijel I am getting this for the last hour after running weblate import_demo:

Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%
Importing base component: 0%

prateekj117 avatar May 05 '22 16:05 prateekj117

@nijel I think running celery tasks is kind of a pre-requisite for the above command. Worked after that.

prateekj117 avatar May 06 '22 09:05 prateekj117

Ah, will you please add this to the documentation?

nijel avatar May 06 '22 12:05 nijel

Hey @nijel, the listing implementation is done. I wanted to make sure that by

it should support adding and deleting screenshot assignments via POST and DELETE methods

you meant, associating screenshot with the specified unit in the post request and in delete request, delete the association. Similar to what we are doing in the screenshots API for units. (Reference)

prateekj117 avatar May 07 '22 11:05 prateekj117

Yes, that's exactly it.

nijel avatar May 10 '22 08:05 nijel