universalviewer icon indicating copy to clipboard operation
universalviewer copied to clipboard

API request: hook for displaying property values

Open eroux opened this issue 6 years ago • 5 comments

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)

eroux avatar Feb 23 '19 16:02 eroux

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());

edsilv avatar Feb 24 '19 11:02 edsilv

Something like that would be perfect yes!

eroux avatar Feb 24 '19 12:02 eroux

I'll add it to the next community call agenda and see if we can get it into the Open Collective development backlog :-)

edsilv avatar Feb 24 '19 13:02 edsilv

great thanks! We might have resources soon to make a pull request if that sounds reasonable

eroux avatar Feb 24 '19 13:02 eroux

Sounds very reasonable! :-)

edsilv avatar Feb 24 '19 14:02 edsilv

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.

LlGC-szw avatar Aug 25 '23 11:08 LlGC-szw

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.

demiankatz avatar Nov 02 '23 17:11 demiankatz