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.33k stars 289 forks source link

[BUG] No default syntax highlighting for Arabic #2525

Closed Felienne closed 2 years ago

Felienne commented 2 years ago

Ok, this is not really a bug, but a wrong decision previously made (in https://github.com/Felienne/hedy/pull/2357)

image

While it makes a lot of sense for Dutch not to highlight keywords by default, for Arabic (and Hindi, and Greek?) we do want to highlight the language itself because these languages are a lot less likely to use English keywords. The issue is also due to the level defaults in Arabic not using {print}, so we also immediately see the English keywords, and see them highlighted.

Maybe we should have categories of languages, "English by default" for Latin languages, and "local by default" for non-latin? Or maybe the highlighter should just be better so there is no confusion (we are working on that)?

But for now, I think we should revert #2357 for Arabic? If those content files also use {print}, we have to see what the situation of the highlighter is then and how we want to approach things.

TiBiBa commented 2 years ago

I'm not sure what would be the best approach, as the highlighting will work in Arabic if the user chosen Arabic as their keyword language on profile settings. The problem seems to be the hard-coded translated keywords in the Arabic YAMLs. When setting the keyword language to Arabic it works fine: Schermafbeelding 2022-04-13 om 13 10 59

But I agree that this is confusing for the end-users. So reversing this will tackle the problem for know but is not really a solution. The best solution would be to update all YAMLs to make sure they use placeholders instead of hardcoded translated keywords. As currently the keywords won't be parsed either when using Arabic with English keywords as there are no placeholders to replace.

Felienne commented 2 years ago

Thinking about it a bit more, what about this:

When switching to a language L, we do show the highlighting in En and L, but we only show the language switcher when people pick a default language in their profile?

Because I think we went on this path mainly because the switcher makes the UI a bit busier?

Felienne commented 2 years ago

The best solution would be to update all YAMLs to make sure they use placeholders instead of hardcoded translated keywords.

This should be fixed in the mean time, so that part is addressed

TiBiBa commented 2 years ago

I will hide the switcher when no keyword language is set on the profile and set the keyword language to the chosen language if this is non-latin. This still has some unwanted changes as all keywords will be parsed to the chose language in this case. So for example, Arabic users will never see the English keywords.