The JS frontend needs a way to get a human readable label for a given vocabulary URI when initiating edit mode on an existing quantity value.
A vocabulary URI is a URI refering to a concept on the designated vocabulary repo. For now, the vocab repo is always the local repo, but in the future, the default vocab repo should be Wikidata. Cinceptually, vocab repo need not be Wikibase repos, and tehre could be more than one vocab repo.
For reference: the relevant functionality is implemented in the backend by EntityLabelUnitFormatter combined with a SuffixEntityIdParser.
Implementation options discussed:
- The JS frontend code could re-use the label that was already rendered into the HTML output by the backend. The unit label could be marked up with a special CSS class, or placed in a data attribute.
The FormatValue API module could support formatting of vocabulary URIs. This would be achieved by introducing a (pseudo-)data type for vocab URIs (using string values). That data type would be somewhat complimentary to the proposed "ID" type: IDs would expand to URIs for normalization. Vocab URIs would be replaced by labels for display. Conceptually, they are quite similar though.Introduce a new API module for formatting vocab URIs.
After some exploration, we decided to go with option 1 for now. An API module as described for option 2 may still be useful, but is not necessary for the task at hand. Filed as T111219.