https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
Web browser: --- Bug ID: 61119 Summary: Querying allmessages always returns English values Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: nullzero.free@gmail.com Classification: Unclassified Mobile Platform: ---
print api.Request(site=pywikibot.getSite(), action='query', meta='allmessages|siteinfo', ammessages="january").submit()
returns
{u'query': {u'allmessages': [{u'*': u'January', u'name': u'january'}], ......, u'lang': u'th', u'wikiid': u'thwiki', ......}
Obviously, it queried in the correct site but got untranslated message.
----
print api.Request(site=pywikibot.getSite(), action='query', meta='allmessages|siteinfo', ammessages="january", amlang="th").submit()
returns
{u'query': {u'allmessages': [{u'*': u'\u0e21\u0e01\u0e23\u0e32\u0e04\u0e21', u'name': u'january'}], ......}
Now it returns correct message.
----
http://th.wikipedia.org/w/api.php?action=query&meta=allmessages&amme...
returns
...... <message name="january" xml:space="preserve">มกราคม</message> ......
It also returns correct message.
So, what happens here?
https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
--- Comment #1 from xqt info@gno.de --- Are you sure that your default site is 'th'?
try again with site=pywikibot.getSite('th')
https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
--- Comment #2 from Sorawee Porncharoenwase nullzero.free@gmail.com --- I'm sure. See the result from my first query.
u'lang': u'th', u'wikiid': u'thwiki', ......
https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
--- Comment #3 from xqt info@gno.de --- I cannot reproduce it:
import pwb import pywikibot from pywikibot.data import api print api.Request(site=pywikibot.getSite(), action='query', meta='allmessages|siteinfo', ammessages="january").submit()['query']['allmessages']
[{u'*': u'\u0e21\u0e01\u0e23\u0e32\u0e04\u0e21', u'name': u'january'}]
print api.Request(site=pywikibot.getSite(), action='query', meta='allmessages|siteinfo', ammessages="january").submit()['query']['general']['wikiid']
thwiki
https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
--- Comment #4 from Sorawee Porncharoenwase nullzero.free@gmail.com --- Okay, I further tested many things and found interesting results.
I at first remove pywikibot.lwp. if I run that code, I will get translated message.
Then, I remove pywikibot.lwp. I run site.login(False) and then that code. Now I get untranslated message.
Then, I remove pywikibot.lwp. I run site.login(True) and then that code. I get translated message.
Have no idea at all why this happens.
https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
Sorawee Porncharoenwase nullzero.free@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bjorsch@wikimedia.org, | |Bryan.TongMinh@Gmail.com, | |roan.kattouw@gmail.com, | |sam@reedyboy.net Component|General |API Version|core (2.0) |1.23-git Assignee|Pywikipedia-bugs@lists.wiki |wikibugs-l@lists.wikimedia. |media.org |org Product|Pywikibot |MediaWiki
--- Comment #5 from Sorawee Porncharoenwase nullzero.free@gmail.com --- This is not a bug of pywikibot. I used curl (https://www.mediawiki.org/wiki/API:Client_code/Bash) and found the very same problem. Perhaps it's API's fault.
https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Component|API |General Version|1.23-git |core (2.0) Resolution|WORKSFORME |--- Assignee|wikibugs-l@lists.wikimedia. |Pywikipedia-bugs@lists.wiki |org |media.org Product|MediaWiki |Pywikibot Ever confirmed|0 |1
--- Comment #11 from xqt info@gno.de --- back to pywikibot. There is an enhencement.
https://bugzilla.wikimedia.org/show_bug.cgi?id=61119
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |FIXED
--- Comment #12 from xqt info@gno.de --- fixed with https://gerrit.wikimedia.org/r/#/c/112604/
pywikipedia-bugs@lists.wikimedia.org