Page MenuHomePhabricator

'ga' translation for 'days' MediaWiki message is wrong
Closed, ResolvedPublic

Description

Could we make pywikibot use en when no ga translation is avalaible?

I keep getting, on ga.wiktionary:

$ pwb.py archivebot User:MABot/config -family:wiktionary -lang:ga -v -simulate
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
Fetching template transclusions...
Found 1 wiktionary:ga processes running, including this one.
Processing [[ga:Vicífhoclóir:Halla Baile]]
148 thread(s) found on [[ga:Vicífhoclóir:Halla Baile]]
Looking for: {{Úsáideoir:MABot/config}} in [[ga:Vicífhoclóir:Halla Baile]]
Processing 148 threads
ERROR: Error occurred while processing page [[ga:Vicífhoclóir:Halla Baile]]
ERROR: IndexError: language "ga" requires 5 plural variants for "$1" but only 1 ("$1 lá") provided
Traceback (most recent call last):
  File ".\scripts\archivebot.py", line 792, in main
    archiver.run()
  File ".\scripts\archivebot.py", line 658, in run
    whys = self.analyze_page()
  File ".\scripts\archivebot.py", line 620, in analyze_page
    why = t.should_be_archived(self)
  File ".\scripts\archivebot.py", line 395, in should_be_archived
    duration = str2localized_duration(archiver.site, re_t.group(1))
  File ".\scripts\archivebot.py", line 176, in str2localized_duration
    exp = i18n.translate(site.code, template, {'$1': int(duration)})
  File "H:\MABot\pywikibot\i18n.py", line 641, in translate
    trans = _extract_plural(code, trans, plural_parameters)
  File "H:\MABot\pywikibot\i18n.py", line 520, in _extract_plural
    return re.sub(PLURAL_PATTERN, replace_plural, message)
  File "C:\Python37\lib\re.py", line 192, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "H:\MABot\pywikibot\i18n.py", line 506, in replace_plural
    '", "'.join(plural_entries)))
IndexError: language "ga" requires 5 plural variants for "$1" but only 1 ("$1 lá") provided
Dropped throttle(s).
Closing network session.
Network session closed.

This will let the bots run as well as start using Irish translations when they're avalaible.

IndexError: language "ga" requires 5 plural variants for "$1" but only 1 ("$1 lá") provided makes me wonder too where this is being defined. I made git grep -i "lá" but got no results.

Thank you.

Event Timeline

Restricted Application added a project: Pywikibot. · View Herald TranscriptMar 24 2019, 1:58 PM
Restricted Application added subscribers: pywikibot-bugs-list, Liuxinyu970226, Aklapper. · View Herald Transcript
Xqt added a comment.Mar 25 2019, 6:14 AM

makes me wonder too where this is being defined. I made git grep -i "lá" but got no results.

This is a mediawiki message for "days" used by the bot.

Xqt renamed this task from Use 'en' as fallback for 'ga' for pywikibot to 'ga' translation for 'days' MediaWiki message is wrong.Mar 25 2019, 6:17 AM

Could we make pywikibot use en when no ga translation is avalaible?

ga translation was wrong

Xqt added a comment.Mar 25 2019, 6:25 AM

Something left to do here?

  • provide tests that translations with plural has that variants that are expected
  • make translations for plurals more stable. If the plural function returns an index which is inside the variants list, take it but don’t raise the Index Error even the number of variants is less than expected

Thanks @Xqt for fixing the MediaWiki:Days/ga message. Translatewiki somewhat complains the message is outdated now because it lacks the PLURAL magic word, although I guess that if "days" in Irish doesn't change between singular and plural it is not needed? I don't speak the language so I can't really assess that.

Alison was also very kind to have the archivebot messages translated as well so once they are committed to the master branch, along with the MediaWiki:Days change, I could recheck if there are further errors.

Dvorapa added a comment.EditedMar 25 2019, 11:11 AM

Perhaps pwb-i18n (or pwb itself?) should always test uploaded TWN translations and report somewhere the issues with plurals like this?

I am still getting ERROR: IndexError: language "ga" requires 5 plural variants for "$1" but only 1 ("$1 lá") provided even though the archivebot summaries are now in the pywikibot-i18n repo, and the MediaWiki:Days/ga is on MW master as well (cfr. 5d914885e581 and b31c55014e61).

I am running the bot from a local copy with both PWB/PWB i18n at master.

Do we need any additional MediaWiki messages fix?

Thanks.

Change 502536 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Take the last plural entry if we don't have enough

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

Xqt added a comment.Apr 9 2019, 4:40 PM

I am still getting ERROR: IndexError: language "ga" requires 5 plural variants for "$1" but only 1 ("$1 lá") provided even though the archivebot summaries are now in the pywikibot-i18n repo, and the MediaWiki:Days/ga is on MW master as well (cfr. 5d914885e581 and b31c55014e61).
I am running the bot from a local copy with both PWB/PWB i18n at master.
Do we need any additional MediaWiki messages fix?

I made a patch which should solve this issue. I guess mediawiki messages wheren't updated in meantime.

Xqt triaged this task as High priority.Apr 9 2019, 4:40 PM
D3r1ck01 moved this task from Backlog to Needs Review on the Pywikibot board.Apr 17 2019, 11:48 AM

Change 502536 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Take the last plural entry if we don't have enough

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

Xqt closed this task as Resolved.Apr 28 2019, 12:35 PM