Fallback chain for language selection of website (P856)
The feature
Right now, we just take the first language available, but we could choose which language a bit smarter. We need to discuss which order it should be, though. Until we have a fully multilingual website, I suggest the following selection chain.
- The language of the user's browser
- English
- Official language of the place the page is about
- The first entry delivered by Wikidata
However, for 1. we need to do it dynamically, so perhaps we should just start with 2-4.
Why?
So that we serve the users more relevant links.
Examples and inspiration
On German Wikivoyage, they have Module:GetP856 to select language. They have this selection chain:
- The language of the wiki
- English
- Official language of the place the article is about
- The first entry delivered by Wikidata
So obviously, they have some logic to be inspired by.
For most part we do try to first pick English then a local language (example).
The query that might need some tuning would be organization-optional.rq as it does not take the local language into account. We should fix that by making the language a query parameter:
https://github.com/govdirectory/website/blob/main/queries/organization-optional.rq#L54
For most part we do try to first pick English then a local language (example).
For labels, yes. As the title suggests, I was thinking specifically for the website.
Could we set a language in the VALUES in countries.rq to use later? Like this?
VALUES (?uri ?name ?safeName ?description ?lang) {
(wd:Q34 'Sweden' 'sweden' 'All Swedish government agencies are included.' 'sv')
Sure, it will only be one language per country (and for some countries this might be important), but it is perhaps an improvement anyway.
I'm thinking we make it a comma separated list fi,se,....
Oh, yes. At least that is putting them in the conversation. I guess in some countries, the order might be debatable and contentious, but that is one step closer.