Fix automatic translation error messages

I experimented with changing the interface language and target translations to Albanian, Bosnian, Bulgarian, Czech, Greek, Hungarian, Polish, Russian, Serbian, Slovakian, Slovenian, Romanian, and Turkish.
The results are as follows:

  • The UI works in all tested languages.
  • Automated content translation works in: Bosnian, Russian, Turkish, Polish, Czech, and Romanian.
  • Automated content translation to Albanian, Bulgarian, Greek, Hungarian, Serbian, Slovakian and Slovenian produces an error message (see the picture).

4 Likes

Just to understand the testing better. You changed your Interface Language to Albanian etc and then you tested to translate from i.e. English. Correct?

Is anyone else getting this type of error?

PS: Another possibility is that you hit the limit of the setting “max translations per minute - The number of translations per minute a regular user can perform.” (set to 10). If this is the case, the error message should be clearer.

Just to understand the testing better. You changed your Interface Language to Albanian etc and then you tested to translate from i.e. English. Correct?

Yes. The testing routine was:

  • Change UI language > check the appearance;
  • Translate a short piece of content from EN into the selected UI language;
  • Translate a short piece of content from a non-European language (like Chinese) into the selected UI language;

I’m pretty sure that “max translations per minute” had no role in this. Language combinations that worked came right after those that did not and vice versa. Plus, I repeated the test later.

1 Like

Ah, can it be that your own Interface Language is set to English UK instead of English US?

Not really.
The problem appears when you try to translate content into the previously selected UI language.
Here are the error messages you get when you set the UI lang. to (for example) Hungarian and Serbian and then click the translation button to translate the content.
Note how the “ok” button language is displayed correctly.

Screen Shot 2022-05-25 at 11.46.43

1 Like

Ok, can you paste the text here (instead of screenshot), please? I will take all this information and report the problem upstream.

If other people are finding this problem in other languages, please report.

Here’s the error code:

{“error”=>{“code”=>400, “message”=>“Invalid Value”, “errors”=>[{“message”=>“Invalid Value”, “domain”=>“global”, “reason”=>“invalid”}], “details”=>[{"@type"=>“type.googleapis.com/google.rpc.BadRequest”, “fieldViolations”=>[{“field”=>“target”, “description”=>"Target language: "}]}]}}

  • Note: In all cases where automatic translation of content does not work, the platform displays the same error message, irrespective of the selected UI language.
1 Like

Reported:

One issue here is that apparently the Google API is called with an invalid target language - not sure if this is a bug in the plugin, or you are just using an unsupported language (although in that case ideally it wouldn’t even offer auto-translation).

The other one is that this error message is really useless for a nontechnical person. It should be prefixed with something human-readable (and translatable) about how the translation failed and please report a bug.

BTW do we monitor these errors automatically?

FWIW it seems to be a bug - I get this with a Hungarian interface and Hungarian does seem to be supported by the Google Translate API.

The Discourse team contacted me saying that they are looking into this problem. For some reason they have unpublished the post and they are following up in a private thread (I think it is just because of our current contract with them, not for security reasons).

The Discourse team says the problem has been fixed. These were new languages added by the Google API that the plugin wasn’t able to recognize.

I haven’t tested this yet. I anyone has a chance to test, please report back!

Machine translation to Hungarian does work now.

1 Like

I have tested Catalan and it works too.

Hi @Patsagorn_Y! So sorry you got an error here:

Could you confirm what kind of error is this? Were you unable to access the translation?

1 Like

We have a 500 Internal Server Error from Amayra, noted by @Alhen in here:

2 Likes

Yes, I have this same error.

Twi language support is buggy as well. Supported by Google Translate but not working here:

1 Like

Google Cloud Translation doesn’t seem to support Twi. Translation requests for non-supported languages should be handled more gracefully than a popup with raw API response; that’s a bug in the Discourse plugin, I think.