Page MenuHomePhabricator

Implement "Monolingual text" in Pywikibot
Closed, ResolvedPublic

Description

I wanted to play around with the new title (https://www.wikidata.org/wiki/Property:P1476) but I noticed we haven't implemented "Monolingual text" yet. The other datatypes at https://www.wikidata.org/wiki/Special:ListDatatypes seem to be implemented.

The data type has two parts:

  • a string
  • the language code (mandatory)

See for example https://www.wikidata.org/w/index.php?title=Q62&diff=prev&oldid=184166426

Or in json:

"P1476": [

    {
        "snaktype": "value",
        "property": "P1476",
        "datatype": "monolingualtext",
        "datavalue": {
            "value": {
                "text": "List of United States counties and county equivalents",
                "language": "en"
            },
            "type": "monolingualtext"
        }
    }
]

(from https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q62&props=claims )

We should probably create pywikibot.WbMonolingualtext for this.

Related Objects

Event Timeline

Multichill raised the priority of this task from to Needs Triage.
Multichill updated the task description. (Show Details)
Multichill subscribed.
jayvdb triaged this task as High priority.Dec 28 2014, 5:32 AM

Does Wikidata use an authority for the list of language codes? Or does it include 'mediawiki' language codes also?

Multichill set Security to None.

Hi Wikidata team, could you please answer jayvdb's question so we correctly implement this data type?

It is currently not consistent between backend and frontend which is a huge problem. I'll add the task for that as blocking.

Change 232406 had a related patch set uploaded (by Smalyshev):
T85385: implement support for monolingual text

https://gerrit.wikimedia.org/r/232406

The patch does not solve the language problem but at least allows to read/save entities with monolingual values/qualifiers/references.

Change 232406 had a related patch set uploaded (by John Vandenberg):
Implement support for monolingual text

https://gerrit.wikimedia.org/r/232406

Please review the patch again, I've updated it.

Change 232406 merged by jenkins-bot:
Implement support for monolingual text values

https://gerrit.wikimedia.org/r/232406

Smalyshev claimed this task.

I think this is resolved now?

We may also want to take a look at https://github.com/inventaire/wikidata-lang for the list of languages.

Change 269936 had a related patch set uploaded (by Xqt):
[fix] enable 'monolingualtext' for WikibaseKnownTypesTests.test_datatypes

https://gerrit.wikimedia.org/r/269936

Change 269936 merged by jenkins-bot:
[fix] enable 'monolingualtext' for WikibaseKnownTypesTests.test_datatypes

https://gerrit.wikimedia.org/r/269936