lisongx / wikidata-elements

Custom HTML elements to reuse Wikidata
https://wikidata-elements.js.org
MIT License
14 stars 2 forks source link

Fallback language #10

Open dominiclooser opened 4 years ago

dominiclooser commented 4 years ago

There are items without a label in a specific language. For example, https://www.wikidata.org/wiki/Q86924750 does not have a label in German. If I specify German, I don't a label back.

It would be nice to have a fallback-language. Perhaps use english as default?

I'm not sure what's the way to go forward, but some kind of solution would be really nice.

lisongx commented 4 years ago

Hi Dominic,

Thanks for using this and reporting this issue! ❤️

That do sounds like a real issue, would something like a comma-separated value as an attribute would work? For example, this is what we have for the wd-link, see the site attribute here:

<a is="wd-link" entity-id="Q80" site="zhwikiquote, enwikiquote">
  Tim's quote
</a>

We can easily add something for the wd-entity, and the API would also be sort of consistent in a way

<wd-entity entity-id="Q42" description lang="en, de, zh, ja"/>

Does this sound like a good way for you as a user?

But I do have an issue personally when I try to use one of the wd-link another day, imagine all the label you specify is not there (for example what if Q42 doesn't have en, de, zh, ja), it's not clear what we should render in this case! Maybe the user can provide a default content? or even a javascript event so the user can hookup some complex logic?

I'm wondering if you have any thought around this. Thanks so much for using this!

dominiclooser commented 4 years ago

I like the version with the commas. I was asking myself if I prefer spaces (like with class attributes), but I guess I prefer commas.

Here the language fallback is discussed: https://meta.wikimedia.org/wiki/Wikidata/Notes/Language_fallback (I haven't read it yet). I think it would be good, if Wikidata would give a last fallback. Perhaps trying English if everything else fails?

There is for sure much space for improvement, but the fallback list alone would help a lot already.