Page MenuHomePhabricator

Get family info from wikidata
Open, Needs TriagePublic

Description

Is there any reason why we code languages in family files instead of getting a (cached) set of values from wikidata?

Event Timeline

Mpaa created this task.Nov 15 2019, 9:00 PM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptNov 15 2019, 9:00 PM

not all (special) projects are Wikidata clients.

Mpaa added a comment.Nov 16 2019, 9:13 AM

not all (special) projects are Wikidata clients.

Then we can do it for those who are and leave the others hard-coded.

(cached) set of values from wikidata?

Isn't there a native API to call, eg. SiteMatrix?

JJMC89 added a subscriber: JJMC89.Nov 17 2019, 4:25 PM

Isn't there a native API to call, eg. SiteMatrix?

Yes: /w/api.php?action=sitematrix&format=json&smsiteprop=url%7Cdbname%7Ccode%7Csitename%7Clang&smlimit=max

{
	"action": "sitematrix",
	"format": "json",
	"smsiteprop": "url|dbname|code|sitename|lang",
	"smlimit": "max"
}
{
    "limits": {
        "sitematrix": 5000
    },
    "sitematrix": {
        "count": 938,
        "0": {
            "code": "aa",
            "name": "Qaf\u00e1r af",
            "site": [
                {
                    "url": "https://aa.wikipedia.org",
                    "dbname": "aawiki",
                    "code": "wiki",
                    "lang": "aa",
                    "sitename": "Wikipedia",
                    "closed": ""
                },
                {
                    "url": "https://aa.wiktionary.org",
                    "dbname": "aawiktionary",
                    "code": "wiktionary",
                    "lang": "aa",
                    "sitename": "Wiktionary",
                    "closed": ""
                },
                {
                    "url": "https://aa.wikibooks.org",
                    "dbname": "aawikibooks",
                    "code": "wikibooks",
                    "lang": "aa",
                    "sitename": "Wikibooks",
                    "closed": ""
                }
            ],
            "dir": "ltr",
            "localname": "Afar"
        },
        "1": {
            "code": "ab",
            "name": "\u0410\u04a7\u0441\u0448\u04d9\u0430",
            "site": [
                {
                    "url": "https://ab.wikipedia.org",
                    "dbname": "abwiki",
                    "code": "wiki",
                    "lang": "ab",
                    "sitename": "\u0410\u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0430"
                },
[...]