Scratch 3 translate requests re-directed to NodeRED HTTP nodes using a chrome extension
Then parsed by Blockly node and result of eval returned back to Scratch
Brings power of javascript to Scratch
[{"id":"5e6b6b53.d78c04","type":"http in","z":"c8a7da0b.8ad438","name":"","url":"/translate","method":"get","upload":false,"swaggerDoc":"","x":90,"y":100,"wires":[["8b7c4be.55fcbb8"]]},{"id":"de319892.1c93d8","type":"http response","z":"c8a7da0b.8ad438","name":"","statusCode":"","headers":{"Access-Control-Allow-Origin":"*"},"x":390,"y":100,"wires":[]},{"id":"605a7fc1.3e2e9","type":"inject","z":"c8a7da0b.8ad438","name":"","topic":"","payload":"{\"text\":\"[1+2]\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":200,"wires":[["8b7c4be.55fcbb8"]]},{"id":"a6cea089.6eee9","type":"debug","z":"c8a7da0b.8ad438","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":370,"y":220,"wires":[]},{"id":"8b7c4be.55fcbb8","type":"Blockly","z":"c8a7da0b.8ad438","language":"en","func":"var message;\n\n\nmessage = (msg['payload']['text']);\n// Remove [ and/or ]\nif (message.charAt(0) == '[') {\n message = message.slice(1, message.length);\n}\nif (message.slice(-1) == ']') {\n message = message.slice(0, message.length - 1);\n}\n// Use eval to process the message\nmessage = String(eval(message));\n// Re-package result to pass back to Scratch 3\nmessage = ['{\"result\":\"',message,'\"}'].join('');\nmsg['payload'] = message;\nreturn msg;\n","workspaceXml":"<xml xmlns=\"http://www.w3.org/1999/xhtml\"><variables><variable type=\"\" id=\"tRt)J6ju,#c{x[U1pP.I\">message</variable></variables><block type=\"variables_set\" id=\"1#8[z=8c+=_~=Q0ULr#K\" x=\"-462\" y=\"-212\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field><value name=\"VALUE\"><block type=\"node_object_get\" id=\"}Lha(ev5jipd*2wwf|9t\"><mutation action=\"GET\"></mutation><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\" id=\"?5)PeuSYW/w|6npl8soI\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"+?KfAUp_a6($,t/G+LYe\"><field name=\"TEXT\">payload.text</field></shadow></value></block></value><next><block type=\"misc_comment\" id=\"WIRVzXH+hmlI*+.9d@KW\"><value name=\"TEXT\"><shadow type=\"text\" id=\"G-BR-,XLXr{67lem9w#q\"><field name=\"TEXT\">Remove [ and/or ]</field></shadow></value><next><block type=\"controls_if\" id=\"KUOuZO+imQGNU3(xJB[!\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"@$Ud+/EKOZn9QqlZ%5Ak\"><field name=\"OP\">EQ</field><value name=\"A\"><block type=\"text_charAt\" id=\"EiPm~/*k27j{Sc|M{^FJ\"><mutation at=\"false\"></mutation><field name=\"WHERE\">FIRST</field><value name=\"VALUE\"><block type=\"variables_get\" id=\".uh:5ru_m0//-%tNx!,O\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field></block></value></block></value><value name=\"B\"><block type=\"text\" id=\"qq]Q`wDc5-~cIFGEKL-c\"><field name=\"TEXT\">[</field></block></value></block></value><statement name=\"DO0\"><block type=\"variables_set\" id=\"CQVibNOb9ME$!PIRvzb;\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field><value name=\"VALUE\"><block type=\"text_getSubstring\" id=\"x}/1BSlZSQNp~79,NQXJ\"><mutation at1=\"true\" at2=\"false\"></mutation><field name=\"WHERE1\">FROM_START</field><field name=\"WHERE2\">LAST</field><value name=\"STRING\"><block type=\"variables_get\" id=\"@S?i8O{S=;P7b$4J::sp\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field></block></value><value name=\"AT1\"><block type=\"math_number\" id=\"@)t-J;cEnYs_-$9CLP!c\"><field name=\"NUM\">2</field></block></value></block></value></block></statement><next><block type=\"controls_if\" id=\"|!@53E@~Z~5Prk)S^$JJ\"><value name=\"IF0\"><block type=\"logic_compare\" id=\"*t/tA0Mfw?ddyac*0Fv5\"><field name=\"OP\">EQ</field><value name=\"A\"><block type=\"text_charAt\" id=\"KQ?:{LT2aPn-rbd?uS-h\"><mutation at=\"false\"></mutation><field name=\"WHERE\">LAST</field><value name=\"VALUE\"><block type=\"variables_get\" id=\"Chy1ta2u|LVv`Amvc{@l\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field></block></value></block></value><value name=\"B\"><block type=\"text\" id=\"0kMv[heEgcW}`Z.5j+lr\"><field name=\"TEXT\">]</field></block></value></block></value><statement name=\"DO0\"><block type=\"variables_set\" id=\"?fhsb}acBq%{Zf1rQtfp\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field><value name=\"VALUE\"><block type=\"text_getSubstring\" id=\"^z%Dflr1)K1=HJF7**3X\"><mutation at1=\"false\" at2=\"true\"></mutation><field name=\"WHERE1\">FIRST</field><field name=\"WHERE2\">FROM_END</field><value name=\"STRING\"><block type=\"variables_get\" id=\"g,wc2-M{/!4ZCUM.~C`|\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field></block></value><value name=\"AT2\"><block type=\"math_number\" id=\"Y/bQQ.a*EM!h@~m~DKtD\"><field name=\"NUM\">2</field></block></value></block></value></block></statement><next><block type=\"misc_comment\" id=\"pL$%3)!S*F*h/uyFFWfL\"><value name=\"TEXT\"><shadow type=\"text\" id=\"KbV6=2]L9vIQ$,?|K(OU\"><field name=\"TEXT\">Use eval to process the message</field></shadow></value><next><block type=\"misc_javascript\" id=\"[:eX51yxUnbyhl7-cz$m\"><value name=\"STATEMENT\"><shadow type=\"text\" id=\"1t?Vp%SuQ@bN2~$M3J]L\"><field name=\"TEXT\">message = String(eval(message))</field></shadow></value><next><block type=\"misc_comment\" id=\"(]5Y3@2N/E%w#4UqgDI}\"><value name=\"TEXT\"><shadow type=\"text\" id=\"c|R*SbW396,l}$_7g9,~\"><field name=\"TEXT\">Re-package result to pass back to Scratch 3</field></shadow></value><next><block type=\"variables_set\" id=\"nRdt[H56mc#x$jb_m6tH\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field><value name=\"VALUE\"><block type=\"text_join\" id=\"{5aa^yGeaA}e#+mHhiEw\" inline=\"true\"><mutation items=\"3\"></mutation><value name=\"ADD0\"><block type=\"text\" id=\"g9y^B`=d6]Fq^D+n.{ts\"><field name=\"TEXT\">{\"result\":\"</field></block></value><value name=\"ADD1\"><block type=\"variables_get\" id=\"@7lQ*N}w.49T,9~Zbu*5\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field></block></value><value name=\"ADD2\"><block type=\"text\" id=\";XB3H60nOwE:#%=pC%@M\"><field name=\"TEXT\">\"}</field></block></value></block></value><next><block type=\"node_object_set\" id=\"TtY/%g}HQ.thV[!)[)+?\" inline=\"true\"><value name=\"object_field\"><shadow type=\"node_msg\" id=\"M).kpUd-=P`$-@}AiR47\"></shadow></value><value name=\"field_name\"><shadow type=\"text\" id=\"$8B#TMu?Jk,_S~VWy{2L\"><field name=\"TEXT\">payload</field></shadow></value><value name=\"value_field\"><shadow type=\"text\" id=\"l%C_@co}{eglIH!)%.D[\"><field name=\"TEXT\"></field></shadow><block type=\"variables_get\" id=\"`(1IxXS^hiy;uAiLtNRT\"><field name=\"VAR\" id=\"tRt)J6ju,#c{x[U1pP.I\" variabletype=\"\">message</field></block></value><next><block type=\"node_return_message\" id=\"*bbcmWYcM1SuE^[3$)+_\"><field name=\"OUTPUT_NR\">1</field><value name=\"MESSAGE_INPUT\"><shadow type=\"node_msg\" id=\"SYNR|[0}wO3nN5A(,1yq\"></shadow></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></xml>","outputs":1,"name":"","x":260,"y":100,"wires":[["de319892.1c93d8","a6cea089.6eee9"]]}]