Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Show translation switcher for some users #4420

Closed
Felienne opened this issue Aug 23, 2023 · 7 comments · Fixed by #4828
Closed

[FEATURE] Show translation switcher for some users #4420

Felienne opened this issue Aug 23, 2023 · 7 comments · Fixed by #4828
Assignees

Comments

@Felienne
Copy link
Member

In #3327 we made it so that only the admin sees the translation option in the editor:

image

But @Mark-Giesen would like to use it as a teacher also. I am open to the idea but the reason we removed it was that it is a bit much to show for student users. I would prefer an option in your profile to enable this (maybe only visible for teacher users)

What do you all think?

@Mark-Giesen
Copy link
Collaborator

There is another option, which is still available to all: the language selector in the cheatsheet. Was this meant as a replacement for this switcher in the editor, or are the use cases different?
We discussed a similar feature once: change the created code into generic code, so replacing all commands with the {} placeholders. This way translators could easily try code and once ready, transform it without typos into YAML text. These options might be combined by having three options available for certain people/settings: EN/selected/generic languages.

@Mark-Giesen
Copy link
Collaborator

See #2573 for the feature mentioned above.

@Felienne
Copy link
Member Author

After more discussion with @Mark-Giesen, we have a plan forward!!

The keyword switcher, that we already support:

image

should just also translate the code in the code box. In essence I think this is a simple fix, which could be done more or less like this:

  • Remove the switcher for the admin (see Only show language switcher on ace when admin #3327 that removes it for all other users)
  • Make sure the UI does not switch to the first tab (I do not know what causes this, we can also do that separately)
  • Call translate_keywords() on the program in the editor

Maybe @Mark-Giesen would like to pick this up (I think it is easier maybe than the yaml generator)

@Mark-Giesen
Copy link
Collaborator

Maybe @Mark-Giesen would like to pick this up (I think it is easier maybe than the yaml generator)

I'm happy to take on both, but it will take some weeks before I have some spare time. End of first quarter coming up, some work deadlines to consider.

@Felienne
Copy link
Member Author

No rush!! Happy to see your contribution when you have time.

@Felienne Felienne self-assigned this Oct 31, 2023
@Felienne
Copy link
Member Author

Felienne commented Oct 31, 2023

We discussed this in the meeting today and we have a path forward:

  • Make the top switcher translate the program too (Felienne can pcik that up, she thinks haha)
  • Remove the switcher in the editor
  • Show the top switcher, also when people are logged in, so they can use the button to switch it
  • Rename the top switcher, so that it does not show the translation emoji, but the current keyword language (so: en or nl)

btw this is what I mean with the top switcher:

Image

@Felienne
Copy link
Member Author

I wil do a few first steps and check back in if I need help

@mergify mergify bot closed this as completed in #4828 Dec 1, 2023
mergify bot pushed a commit that referenced this issue Dec 1, 2023
Fixes #4420 

**Some background**

I want to describe a bit of background here because this is such a lovely example of a set of very reasonable decisions leading to bad design!

When we introduced the keyword languages, we added a switcher on the top of the screen, to switch all code examples in the adventures. So far so good. But we also switched start codes in the editor and translated them (since they have {}, the translation does not mean *parsing* but means grabbing from the yaml file and replacing the keywords). This happens when you have not written code yet. If you do, it does not load the startcode and then it does not translate.

But... Since we seems to translate code in the editor... people thought it could also translate their own code. It actually took me a long time to figure out why people (like @Mark-Giesen) thought that that is what the button would do! 

This PR makes the one button translate in the editor too. 

**Limitations**

The error handling in the translation code is currently quite limited. I tried to expand it in e08375d but it will involve extensive refactoring to do it nicely, so I prefer to do that separately.

I was also planning to Rename the top switcher so that it does not show the translation emoji, but the current keyword language (so: en or nl), but this leads to some design issues (#4828 (comment)) that I also want to address separately.

**Changes**

* Makes the top switcher translate the program too
* Removes the switcher in the editor for the admin 
* Gives an error message in the regular place instead of a shortlived modal
* Show the top switcher, also when people are logged in, so they can use the button to switch it -> was already the case!

**How to test**
Set Hedy to any non-En language and write code in that language (f.e. slaap 20 in Dutch, level 4). Use the toggle and observe the keywords being translated.
Create a broken program with a parse error and see the error message appear below:

![Uploading image.png…]()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants