MrYsLab / s2m

Scratch to micro:bit bridge.
https://mryslab.github.io/s2m/
GNU Affero General Public License v3.0
35 stars 19 forks source link

Localization Support #2

Closed champierre closed 6 years ago

champierre commented 6 years ago

s2m has English UI only. It would be great if it supports other languages. Localization support would be mandatory if students in elementary school wants to use s2m.

You can switch the block UI based on browser language.

Here is the code of an ScratchX extension that I created. I think you can use similar logic.

https://github.com/champierre/scratch2mip/blob/master/scratch2mip.js#L32

Let me know if you need help for Japanese translation.

MrYsLab commented 6 years ago

I agree about the translations. The program uses the Scratch HTTP interface and the block specification can be found here: https://github.com/MrYsLab/s2m/blob/master/s2m/scratch_files/extensions/s2m.s2e

The specification from Scratch can be found here: https://wiki.scratch.mit.edu/w/images/ExtensionsDoc.HTTP-9-11.pdf

You can change the blocks to Japanese if you wish and I would be happy to publish those. Currently the names of the images are in English, but I would be willing to look at mapping the English names to numerical value so that the Japanese could appear in the block. I will investigate and get back to you on this. The way things would work is there would be another command line option to pick the language.

If you change s2m.s2e to Japanese, to load the blocks into Scratch, press and hold the Shift key and select File at the top of Scratch. You will see an option to load the extension. The blocks should appear in the More Blocks section. If you then save the project, you will have a project which can be loaded as a normal .sb2 file.

I am starting to look at Scratch 3.0 and hopefully extensions will be supported. They will most likely be similar to ScratchX.

MrYsLab commented 6 years ago

Here is my current thinking. For translating the images in the Display image block, when translating the image names (HAPPY, SAD, etc.), each name would be preceeded with a 2 digit number in the .s2e file. So for example, "HAPPY" would be "01 HAPPY" where the word HAPPY is translated into the user's native language. This will allow me to key off the number and allow users not to have to see English.

The reason for all of this, is that micropython uses the English names as references to the images.

The values returned from the pointy reporter blocks, such as "shaken?" seem to always report as either true or false, no matter what language is selected in the editor, so this is not something that be easily fixed. I hope this would acceptable

Since all of the other fields in the blocks are numeric, I don't think they can remain as they are.

The only block that may be a problem is the scroll block, since the micropython library currently only understands English characters and strings. This block could be removed from the .s2e if it is felt it is not needed and having English only would lead to confusion.

I think this approach means not having to maintain configuration files and also means no changes to my code once I implement the scheme to handle the numeric values added to the image names.

Let me know your thoughts about all of this.

Thanks.

champierre commented 6 years ago

I think the best approach is to be consistent with official JavaScript Blocks Editor as much as possible.

Image names are better to be same as what appears in JavaScript Blocks Editor.

2017-11-28 8 53 59

The values, true or false, returned from the pointy reporter blocks are fine to be as they are. Numeric fields are also fine.

English characters in the scroll block are fine. JavaScript Blocks Editor also keep English "Hello" in the field. Maybe it is better to have "Hello" instead of "Replace With Your Text", because "Hello" is easier phrase for non-native English speaker.

2017-11-28 8 54 58
MrYsLab commented 6 years ago

I am going to provide instructions on how to translate the blocks in the user guide. I will let you know when it is ready and you can comment and give suggestions.

MrYsLab commented 6 years ago

I have updated the User's Guide by adding a section on translating the blocks. https://mryslab.github.io/s2m/translation/

Please let me know if you have any comments or suggestions.

I am closing this issue, but please feel free to comment here.

champierre commented 6 years ago

I submit PR for Japanese translation. https://github.com/MrYsLab/s2m/pull/3

MrYsLab commented 6 years ago

To automatically load the Japanese blocks, install version 1.09 and then type:

s2m -l 1
champierre commented 6 years ago
s2m -l 1

load the Japanese blocks. It works perfectly.

Just one thought. I think it would be better if the command is

s2m -l ja

If you have more languages, magic number like "1" is hard to remember.

MrYsLab commented 6 years ago

This is easy enough to do. I will consider it in the next release. I am not sure it is totally necessary because:

  1. If you type:

    s2m -h

    the translations are listed in the help displayed.

  2. For Windows, I would think in the classroom setting a .bat file would be created and added to the desktop so that the students would just click on an icon. (I am going to update the User's Guide with how to do this.), but I am not sure if this is easily done on a Mac or not.

MrYsLab commented 6 years ago

@champierre I just wanted to let you know that I will be adding the "ja" option to select Japanese when starting s2m.

I am also changing the way the Write Pixel block works. Instead of drop-down menus for the x, y, and brightness, I will be changing this to numeric entry fields. This is to allow for using variables in those parameters.

You do not have to make any changes, I will make them here.

Lastly, I have changed some of the internal code that results in lower CPU utilization and better response for sensors. In addition, I have changed the delay in the micro: bit script as well.

I will let you know when I release. It should be tomorrow or the next day.

MrYsLab commented 6 years ago

@champierre Your request for accepting ja has been implemented in release 1.10

champierre commented 6 years ago

Great!! Japanese kids would be glad to use s2m. I introduced s2m in my Japanese blog.

http://blog.champierre.com/1112

MrYsLab commented 6 years ago

Thank you. I just provided a link to your article on my blog.