Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic for getting values from LabelValuePair #74

Closed
wants to merge 1 commit into from

Conversation

jbaiter
Copy link
Contributor

@jbaiter jbaiter commented Sep 28, 2020

This fixes a faulty heuristic introduced in #60, which would override the default locale with the locale of the first label and then attempt to fetch the value with that logic.

This heuristic breaks e.g. in the simple case were labels are available in multiple languages, but the values only available in one. If the first language of the labels did not correspond to the language of the value, the client would get no value back.

This is clearly in violation of the algorithm prescribed for IIIF property values in the Presentation API spec, which states:

If none of the values have a language associated with them, the client must display all of the values.

and

If all of the values have a language associated with them, and none match the language preference, the client must select a language and display all of the values associated with that language.

as well as

If some of the values have a language associated with them, but none match the language preference, the client must display all of the values that do not have a language associated with them.

This fixes a faulty heuristic introduced in IIIF-Commons#60, which would override
the default locale with the locale of the first label and then attempt
to fetch the value with that logic.
This heuristic breaks even in the simple case were labels are available
in multiple languages, but the values only available in one. If the
first language of the labels did not correspond to the language of the
value, the client would get no value back.
This is clearly in violation of the algorithm prescribed for IIIF
property values in the Presentation API spec[1], which states:

> If none of the values have a language associated with them, the client
> must display all of the values.

and

> If all of the values have a language associated with them, and none
> match the language preference, the client must select a language and
> display all of the values associated with that language.

as well as

> If some of the values have a language associated with them, but none
> match the language preference, the client must display all of the values
> that do not have a language associated with them.

[1] https://iiif.io/api/presentation/2.1/#language-of-property-values
@jbaiter
Copy link
Contributor Author

jbaiter commented Oct 1, 2020

This has been superseded by #75.

@jbaiter jbaiter closed this Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant