Page MenuHomePhabricator

Using @translate without language parameters but with a multi-word translation string results in an exception
Open, Needs TriagePublic

Description

@translate takes three positional parameters: input language code, output language code, and the string to be translated. If one or all of the language codes are omitted, wm-bot will respond with "Invalid number of parameters":

[12:41:55] <AntiComposite> @translate Bonjour
[12:41:56] <+wm-bot> Invalid number of parameters
[12:51:29] <AntiComposite> @translate Bonjour monsieur
[12:51:30] <+wm-bot> Invalid number of parameters

If there are three space-seperated words in the command the bot decides that's good enough. Yandex, understandably not knowing what language code "Bonjour" is, responds with a 400 (Bad request) and wm-bot raises an exception.

[12:44:18] <AntiComposite> @translate Bonjour je m'appelle
[12:44:18] <+wm-bot> DEBUG Exception in module Translate: The remote server returned an error: (400) Bad Request. st:   at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in <filename unknown>:0   at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0

The problem is that wm-bot raises these exceptions in #wm-bot, so the person running the command likely won't see it. If Yandex supports automatic language guesses, wm-bot should try to use that. wm-bot should also not accept more than two or three-character language codes. In any case, a useful error message should be sent to the original channel, not #wm-bot.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 5 2019, 4:57 PM
Aklapper renamed this task from Using @translate without language paramters but with a multi-word translation string results in an exception to Using @translate without language parameters but with a multi-word translation string results in an exception.Sep 5 2019, 6:42 PM

(Did @Petrb explicitly agree to work on this?)

AntiCompositeNumber added a comment.EditedSep 5 2019, 6:45 PM

(@Aklapper I used the task template linked on https://meta.wikimedia.org/wiki/Wm-bot#Support, which auto-assigns.)

Ah, thanks! I'd say that meta page should get fixed: Auto-assigning tasks is a cookie-licking anti-pattern. @Petrb: Maintainers can subscribe to project tags instead.

Petrb removed Petrb as the assignee of this task.Mar 27 2020, 7:24 PM
Petrb added a subscriber: Petrb.
MacFan4000 moved this task from Unsorted to Bug on the WM-Bot board.Apr 28 2020, 1:06 AM