Page MenuHomePhabricator

i18n.translate() fails for any extended dict if code is given as string and not as Site object
Closed, ResolvedPublicBUG REPORT

Description

For example have a look to the netext dict in welcome.py. Looking up the 'commons' entry is successful for a site object but it fails for a bare 'commons' code:

>>> import pwb, pywikibot as py
>>> from pywikibot.i18n import translate
>>> from scripts.welcome import netext
>>> s = py.Site('commons', 'commons')
>>> translate(s, netext)
'{{subst:welcome}} %s'
>>> translate('commons', netext) is None
True

Event Timeline

Xqt triaged this task as High priority.Jun 20 2020, 3:12 PM
Xqt changed the subtype of this task from "Task" to "Bug Report".

Change 606671 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Lookup the code parameter in xdict first

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

Change 606671 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Lookup the code parameter in xdict first

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

Change 606671 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Lookup the code parameter in xdict first

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