Multilinguality in the md:term API

Since last weekend, the last publicly accessible page of museum-digital has been made fully multilingual: md:term. md:term is the central public frontend for our controlled vocabularies of actors, places, tags, and time terms.

The probably most important part of md:term is its API, which is also – for example – used by the “graph navigation” and is available for external use as well. Since we – like anywhere else – do not require authentication for accessing the md:term API, we don’t have a full list of API consumers which we could contact about API changes. Hence, we hope that this blog post will also alert them to make necessary changes.

How then, is md:term made multilingual? And how does it express itself in md:term?

Months ago, we implemented the multilinguality in our controlled vocabularies by adding an additional translation table, which means that there is the base entry, which is entered by the museums. The “norm data editors” then enrich the data and also attempt to add translations to a separate table by fetching data from Wikidata. If translations in the user’s language are available, they replace the “base entry” when outputting the data.

In the API, the base entries are replaced as well. If they are used, it hence makes sense to explicitly state the wanted language of the entry. To fetch German language information on Berlin easily, one should thus query https://term.museum-digital.de/md-de/place/61/json?lang=de instead of https://term.museum-digital.de/md-de/place/61/json (which, before multilinguality, would have been the appropriate URL).

Alternatively, there is a new section in the JSON API: langs. All available translations can be found there listed by language.