RDFLib/prez

Standardise handling language tags

Opened this issue · 0 comments

Each endpoint in the API handles language tags for labels differently. We should keep this behaviour consistent for all endpoints.

Here's the current behaviour:

  • /v/<vocab_curie>/all - Return either @en or labels with no language tags, ignore all other languages
  • /v/<vocab_curie>/top-concepts - this one is strange. The same concept that has multiple languages shows up as multiple items: first returns alphabetically the first label regardless of language and @en, then @en, then first label in the order (or alphabetically first language tag) and @en.
  • /v/<vocab_curie>/<concept_curie> - Return all labels
  • /c/catalogs/<catalog_curie> - Return either @en or labels with no language tags, ignore all other languages

I'll continue to add to this list over time.

Ideally the backend should return all languages, and the frontend can get the browser preferred language and display the appropriate language in the following priority order:

  1. Preferred language
  2. @en
  3. @en-* (e.g. @en-us, @en-gb, etc.)
  4. no language tag
  5. Other language tags

This frontend functionality (except for using the browser language) was added in RDFLib/prez-ui#105