lisongx/wikidata-elements

Fallback language

Opened this issue · 2 comments

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.

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!

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.