hedyorg / hedy

Hedy is a gradual programming language to teach children programming. Gradual languages use different language levels, where each level adds new concepts and syntactic complexity. At the end of the Hedy level sequence, kids master a subset of syntactically valid Python.
https://www.hedy.org
European Union Public License 1.2
1.29k stars 284 forks source link

[CHORE] Stop translating non-user facing error messages #4201

Open rix0rrr opened 1 year ago

rix0rrr commented 1 year ago

Describe the issue

I'm noticing that we are currently using gettext() everywhere for 30x and 40x error messages (not the ones in the programming UI)

image

These error messages should never surface to normal users: they are indications of programming errors on our parts, and they are intended for us (programmer adults who speak English). I would say they don't need to be translated. However, by the fact that we put them in gettext(), they now become translation load for all the volunteer translators.

Suggestion

Let's stop using gettext() for programmer-targeted error messages, and just the error message in the source directly?

Felienne commented 1 year ago

Ah good catch @rix0rrr! I agree, we could surely stop translating some of these.

A hardliner could argue that for a user that uses Hedy entirely in non-English, it is weird to see English error messages "leaking out"; thus revealing that the underlying technology is English, but yeah, the underlying technology is English, sooner or later that will be clear.

The only exception I think might be level_invalid? Kids are extremely likely to try if there is a level 100 or 1000 or 202, this is not a thing (like an ajax error) that is caused by a programming error.

image

The quiz does not show a route url, so kids are not likely to run into errors there too:

image
TiBiBa commented 1 year ago

Agree! We should only return English for the errors that shouldn't occur in a normal user flow. However, I also agree with @Felienne that all errors with possible user interaction should be translated. I think the main issue here is our handling and validation of requests.

Currently we have several manual checks on the provided JSON to validate if the object is as expected. This is cumbersome, hard to maintain and also introduces some risks (what if we miss a check for one value?). I would propose to use something like JSON schema to easily validate request bodies.