universalviewer
universalviewer copied to clipboard
API request: hook for displaying property values
Here is our use case:
We are dealing with languages that can be displayed in various manners, for instance:
- Tibetan displayed in:
- Unicode Tibt script
- EWTS transliteration
- another transliteration usually used by scholars (which has no name)
- Sanskrit displayed in:
- various Unicode scripts (Devanagari, Prachalit, and many others)
- IAST transliteration
- ISO15919 transliteration
- (in some cases)Tibetan and the various Tibetan transliterations cited above
We allow our users to specify some preferences and want to display the labels of the manifests in the language and transliteration chosen by the user. We don't want to include all these labels into our manifests because moving from one transliteration to another is a 1:1 translation (and including them all would make our manifests less readable). So we would like to implement the mechanism to display a property value ourselves.
So the request is:
Would it be possible to allow users (in the sense of users of the API) to give UV a JavaScript function taking the value of a Property Value and returning the string UV should display? That way we would handle all the complexity ourselves.
(related: https://github.com/ProjectMirador/mirador/issues/1959)
Hi @eroux
Internally, the UV uses: https://iiif-commons.github.io/manifesto/classes/languagemap.manifesto.languagemap.html#getvalue to get translations. It's possible that we could abstract this further into a util that allows this defualt behaviour to be overridden to use whatever translation function you pass in. E.g.
createUV('#uv', {
iiifResourceUri: 'http://wellcomelibrary.org/iiif/b18035723/manifest',
configUri: 'uv-config.json',
translateHook: function(value) {
return myTranslationFunction(value);
}
}, new UV.URLDataProvider());
Something like that would be perfect yes!
I'll add it to the next community call agenda and see if we can get it into the Open Collective development backlog :-)
great thanks! We might have resources soon to make a pull request if that sounds reasonable
Sounds very reasonable! :-)
All issues will be triaged for further investigation or closure by the 28 September 2023. If your issue is still relevant and would like for it be investigated further please comment by 14 September 2023.
Closed due to inactivity (and because it was previously closed as completed, then reopened). If there is still a need, please open a new issue.