= Goal =
To design a method for Wikibase gadgets be portable between instances.
= Context =
In Wikidata (and SDC) we have a nice ecosystem of gadgets, many of then provide enormous productivity. When using a different instance (on wb.cloud, on WBS Deploy, etc) any gadget using an specific hardcoded Wikidata property will not work because, if the equivalent property is available, the local id will be different.
As an example, say the [[ https://toolhub.wikimedia.org/tools/currentdate | currentDate ]] gadget. It's simple but very helpful for entering quality references. And it's hardcoded to the P813 Wikidata property. What we are looking for is a method implemented in currentDate for making it portable to any Wikibase instance.
= Frist draft =
At this moment I don't have a draft but a minimal idea of how could be implemented. Roughly like:
- when gadget runs, it gets from its configuration the value of the local equivalent for Wikidata's P813 and do its thing;
- if this value is not available (probably is the first time it is run), it query for a property with [[ https://phabricator.wikimedia.org/T391815 | P9 ]] equal to P813;
- if there is a property equivalent to P813, the gadget saves its value;
- if there is not a property equivalent to P813, the gadget asks for the creation of a new property (in could output the quickstatements code for it) and stops.
And yes, this method can work only if we have agreed about the minimalist set of properties we propose at T391815.
I wrote this as an example and probably it doesn't work like this because know the JS is triggered. But maybe works as inspiration for a seasoned gadget programmer.