Details
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Resolved | Lydia_Pintscher | T196162 Adding a new Sense | |||
| Resolved | Lydia_Pintscher | T198036 Validating the language of a Gloss | |||
| Resolved | Lydia_Pintscher | T74126 [Story] Monolingual text does not accept sr-cyrl and a number of other language codes | |||
| Declined | None | T74590 [Bug] Monolingual code is missing for Romani (rom) and Scandoromani (rmg-variant) | |||
| Resolved | • adrianheine | T72205 [Story] Mono-lingual text datatype should support "no linguistic content" and "undetermined language" | |||
| Resolved | Smalyshev | T85385 Implement "Monolingual text" in Pywikibot | |||
| Resolved | • adrianheine | T95286 [Story] Monolingual text should support macrolanguages | |||
| Open | None | T124286 [Epic] Wikidata language support | |||
| Resolved | Addshore | T78006 [Story] Determine list of available languages in a uniform way | |||
| Resolved | Lucas_Werkmeister_WMDE | T198202 Add API to check language code validity / get all valid language codes | |||
| Resolved | Addshore | T202749 Document action=query&meta=wbcontentlanguages on mediawiki.org |
Event Timeline
Well, which one is it – do we add an API to check language code validity, or one to get all valid language codes? :)
Personally, I’d favor one to get all valid language codes for lexeme terms (i. e. lemmas, representations and glosses – currently we use the same validator for all of them), and expose it perhaps via action=query&meta=siteinfo as a new siprop.
Alternatively, for client-side checking we could also expose the list via a ResourceLoader module?
It seems that we do this differently for Monolingual texts atm: There this is handled via wikibase.WikibaseContentLanguages which is basically an access wrapper for mw.config.get( 'wgULSLanguages' ) (some languages supported by the backed are missing, though). This is being discussed in T124758.
Input validation is then being handled by the api (after an attempt save).
Talking to @Addshore, we probably want to go for something along the lines of [[https://www.wikidata.org/w/api.php?action=query&meta=wikibasecontentlanguages&context=gloss|action=query&meta=wikibasecontentlanguages&context=gloss]].
One question I just came across… what language shall we show the available languages in? Shall we use autonyms (native names)? What about languages that are not in CLDR?
We can either integrate these names into the API output (which is ok for autonyms, but maybe a little uggly otherwise, if this depends on the user's lang) or fetch them from ULS (as far as they're available… does ULS have all CLDR langs?).
Alternatively we could just resort to language codes and not show any names…
What’s the problem with including the names in the user language in the API output? That doesn’t feel ugly to me.
Perhaps the output structure could be something like this:
"wikibasecontentlanguages": { "en": { "code": "en", "autonym": "English", "name": "inglés" }, // ... }
with some kind of wbclprops parameter to select what you want (wbclprops=code|autonym|name).
Since I’m running out of other things to do, I’ll take a stab at implementing one suggestion for such an API module.
Change 452710 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] WIP: Centrally collect various kinds of content languages
Change 452711 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] WIP: Add API to query content languages
Change 452712 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Register lexicographical content languages
Change 454238 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Wikibase@master] Add WikibaseContentLanguagesProvider
Change 452710 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Centrally collect various kinds of content languages
Change 452712 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Register lexicographical content languages
Change 452711 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add API to query content languages