Open JMRUIZ1 opened 9 years ago
In case anybody looking at this issue is wondering, the original question is asking about Ardublockly translations, if its possible and how to do it, in particular a spanish translation.
At the moment the text in the Arduino specific blocks are not included in the language file for Blockly, but all the original blockly blocks have translations.
Basically what first needs to happen for it to be fully translated is to move all literal strings from the files in the blockly/blocks/arduino folder into the blockly/msg/messages.js file.
So, for example this io_digitalwrite block needs to be changed from:
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(Blockly.Blocks.Arduino.io.HUE);
this.appendDummyInput('')
.appendField('set digital pin#')
.appendField(new Blockly.FieldDropdown(
Blockly.Arduino.Boards.selected.digitalPins), 'PIN');
this.appendValueInput('STATE', Blockly.StaticTyping.BlocklyType.BOOLEAN)
.appendField('to')
.setCheck(Blockly.StaticTyping.BlocklyType.BOOLEAN);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip('Write digital value to a specific Port.');
to:
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(Blockly.Blocks.Arduino.io.HUE);
this.appendDummyInput('')
.appendField(Blockly.Msg.IO_DIGITALWRITE_TITLE)
.appendField(new Blockly.FieldDropdown(
Blockly.Arduino.Boards.selected.digitalPins), 'PIN');
this.appendValueInput('STATE', Blockly.StaticTyping.BlocklyType.BOOLEAN)
.appendField(Blockly.Msg.IO_DIGITALWRITE_TITLE_2)
.setCheck(Blockly.StaticTyping.BlocklyType.BOOLEAN);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.IO_DIGITALWRITE_TITLE_TOOLTIP);
(in this case, there are two strings inside the block, IO_DIGITALWRITE_TITLE and IO_DIGITALWRITE_TITLE_2, this is not a good practice for translations, but once we've got the majority of the strings moved I can look into changing it to a better way)
So, the strings are then moved into the blockly/msg/messages.js file:
// Meaningful description
Blockly.Msg.IO_DIGITALWRITE_TITLE_TITLE = 'set digital pin#';
Blockly.Msg.IO_DIGITALWRITE_TITLE_TITLE_2 = 'to';
Blockly.Msg.IO_DIGITALWRITE_TITLE_TOOLTIP = 'Write digital value to a specific Port';
Once that is done, the language files can be automatically generated to include all the new strings, and then it's a matter to edit the translation in the respective file, like this file for the spanish language.
Hola Jose,
Por el momento the texto en los bloques especificos de Arduino no estan incluidos en la traduccion general de Blockly, pero todos los otros bloques tienen traducciones.
Principalmente lo que tiene que pasar primero para poder traducirlo es mover todos los strings
de texto de los archivos incluidos en la carpeta blockly/blocks/arduino a dentro del archivo blockly/msg/messages.js.
Por ejemplo, para este bloque io_digitalwrite necesitariamos cambiar el siguiente codigo:
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(Blockly.Blocks.Arduino.io.HUE);
this.appendDummyInput('')
.appendField('set digital pin#')
.appendField(new Blockly.FieldDropdown(
Blockly.Arduino.Boards.selected.digitalPins), 'PIN');
this.appendValueInput('STATE', Blockly.StaticTyping.BlocklyType.BOOLEAN)
.appendField('to')
.setCheck(Blockly.StaticTyping.BlocklyType.BOOLEAN);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip('Write digital value to a specific Port.');
al siguiente:
this.setHelpUrl('http://arduino.cc/en/Reference/DigitalWrite');
this.setColour(Blockly.Blocks.Arduino.io.HUE);
this.appendDummyInput('')
.appendField(Blockly.Msg.IO_DIGITALWRITE_TITLE)
.appendField(new Blockly.FieldDropdown(
Blockly.Arduino.Boards.selected.digitalPins), 'PIN');
this.appendValueInput('STATE', Blockly.StaticTyping.BlocklyType.BOOLEAN)
.appendField(Blockly.Msg.IO_DIGITALWRITE_TITLE_2)
.setCheck(Blockly.StaticTyping.BlocklyType.BOOLEAN);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setTooltip(Blockly.Msg.IO_DIGITALWRITE_TITLE_TOOLTIP);
(en este caso especifico, hay dos strings
dentro del bloque, IO_DIGITALWRITE_TITLE y IO_DIGITALWRITE_TITLE_2, lo cual no es una buena practica para las traducciones, pero tan pronto como el texto se haya movido al archivo adecuado me puedo encargar de mejoralo al formato correcto)
Finalmente, esas strings
se tienen que mover al archivo blockly/msg/messages.js:
// Meaningful description
Blockly.Msg.IO_DIGITALWRITE_TITLE_TITLE = 'set digital pin#';
Blockly.Msg.IO_DIGITALWRITE_TITLE_TITLE_2 = 'to';
Blockly.Msg.IO_DIGITALWRITE_TITLE_TOOLTIP = 'Write digital value to a specific Port';
Una vez esto este hecho, los archivos de lenguaje pueden ser automaticamente generados para incluir las nuevas strings
. Despues simplemente es cuestion de editar la traduccion en los respectivos archivos, en este caso seria este archivo para la lengua española.
Hell everybody, thanks a lot for your work on Blockly. I tried to create a wiki about this particular point : http://tic.technologiescollege.fr/wiki/doku.php/en/blockly_rduino/create_blocks
Tell me if it's undestandable. There's a lot of file ot change on BlocklyDuino about this point.
Thanks.
The first step for internationalisation has been implemented in commit https://github.com/carlosperate/ardublockly/commit/c66958626cf8657aa9491d1961e64e876574d1ae.
So far this will only trigger a language change in the core blockly blocks, a list of what has been done and is left has been added to the initial message on this issue (as it is the only way to trigger github task tracker).
Hi, I was wondering where were the question of internationalisation? I propose my help for a french version of it. and thanks again for the great tool
Hi @isokar, I am not quite sure I understand your question, could you rephrase it? Are you wondering how to change the language in the Ardublockly application? We have a base for the french translation (as you can see in blockly/msg/js and blockly/msg/json/fr.json), but if there is anything missing or that might require some tweaking contributions are more than welcomed :)
Hola Carlos
He visto tu trabajo sobre Ardublockly y me gustaría realizar la traducción al español de la herramienta. ¿Será posible? ¿Que ficheros debo traducir?. Me gustaría poder utilizarla con mis alumnos y en los cursos de formación que imparto sobre Entornos de Programación de Arduino
También estoy interesado en una versión directamente ejecutable desde Windows de la aplicación Ardublockly, ¿existe?.
saludos
Profesor José Manuel Ruiz Gutierrez España
Repository owner edit to trigger Github task list for this issue: