IBM / taxinomitis

Source code for Machine Learning for Kids site
https://machinelearningforkids.co.uk
Apache License 2.0
147 stars 140 forks source link

NLS for the blocks in ScratchX #161

Closed gabrielcbe closed 2 years ago

gabrielcbe commented 5 years ago

Hello, Dale.

With the recent updates is now possible to have the translated version of the blocks "Recognise text/image (label/confidence)" in Scratch 3.0, is it too much trouble/can you apply these changes to ScratchX as well?

Due to a limitations in the Raspberry Pi we use as primary computer during classes, my students are still going to use ScratchX over the newer Scratch 3.0 and it'd be great to have the blocks translated there too.

Thanks a lot!

dalelane commented 5 years ago

Not sure - I'll look into it!

garrapato commented 5 years ago

hello @gabrielcbe , I think I can contribute with that translation, send me a note to garrapato@me.com please

dalelane commented 5 years ago

@garrapato The extensions are all here - if you can offer any tips on technically how they can be NLS-enabled that would be much appreciated!

https://github.com/IBM/taxinomitis/blob/master/resources/scratchx-text-classify.js https://github.com/IBM/taxinomitis/blob/master/resources/scratchx-images-classify.js https://github.com/IBM/taxinomitis/blob/master/resources/scratchx-numbers-classify.js

garrapato commented 5 years ago

The mechanism used by Scratch 2.0 is through files of substitute character strings, so for each language, there should be a file with the format aa.po or aa-bb.po, where aa is the language identifier and bb It is the country identifier, for example: pt-br.po, for Brazilian Portuguese.

These files must be placed in the 'locale' subdirectory, where 'Scratch.swf' resides, see links to graphics, for example, in my case:

/Users/garrapato/scratchx/locale/pt-br.po

example: pt-br.po append the lines below to translate the statics strings in the MLK extensions:

#------------------------------------------------------------------------------------
# Machine Learning for Kids extensions
#------------------------------------------------------------------------------------

# Semaphore

# RED
msgid "No models trained yet - only random answers can be chosen"
msgstr "Nenhum modelo treinado ainda - apenas respostas aleatórias podem ser escolhidas"

# YELLOW
msgid "Model not ready yet"
msgstr "Modelo ainda não está pronto"

# GREEN
msgid "Ready"
msgstr "Pronto"

# Image Classify extension

msgid "recognise image %s (label)"
msgstr "reconhecer imagem %s (etiqueta)"

msgid "recognise image %s (confidence)"
msgstr "reconhecer imagem %s (confiança)"

msgid "add training data %s to %m.labels"
msgstr "adicione dados de treinamento %s a %m.labels"

msgid "add training data %s to %s"
msgstr "adicione dados de treinamento %s a %s"

# Text Classify extension

msgid "recognise text %s (label)"
msgstr "reconhecer texto %s (etiqueta)"

msgid "recognise text %s (confidence)"
msgstr "reconhecer texto %s (confiança)"

# Number Clasiffy extension

# N/A - Dinamiclally generated
NLS

@dalelane will have to update that file so that the Scrtatchx version of MLK can use the translation.

Once this file is updated, when selecting the language (Brazilian Portuguese), Scratchx will replace static strings with those found in the translation file. Do not forget to refresh the page.

Lingua

The Number Classification extension does not contain static strings, so it is not possible to translate.

Next, examples of the translation of the semaphore status are shown.

RED:

Nenhum modelo

YELLOW:

Ainda nao

GREEN:

Pronto

The Brazilian Portuguese and Mexican Spanish files below

pt-br.po file (full)

pt-br.po.zip

es-mx.po file (full)

es-mx.po.zip

I hope you find this information useful.

Regards

dalelane commented 2 years ago

closing as I don't think further investment in ScratchX is worth it any more