Screenshot link for units (API)
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!
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
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?
Yes, see https://docs.weblate.org/en/latest/contributing/start.html#bootstrapping-your-devel-instance
@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%
@nijel I think running celery tasks is kind of a pre-requisite for the above command. Worked after that.
Ah, will you please add this to the documentation?
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)
Yes, that's exactly it.