mo4islona / node-blockly

Blockly for Node.js and Browser via CommonJS module
133 stars 81 forks source link

Blockly Update Broke Localization #18

Closed NAllred91 closed 6 years ago

NAllred91 commented 6 years ago

I'm pretty sure a blockly update broke localization, and by extension the entire toolbox, in 1.0.28.

https://github.com/google/blockly/blame/81dcdcb287e7027450336c74a104e8438e23e364/core/utils.js#L474

Looks like this:

 if (Blockly.Msg[msgKey] == null) {

Changed to this:

if (Blockly.utils.getMessageArray_()[msgKey] == null) {
NAllred91 commented 6 years ago

I think it has something to do with the usage of goog.global['Blockly'] in the utils.js around line 52, but I'm not completely sure.

NAllred91 commented 6 years ago

@mo4islona I'm going to look into this more tomorrow. I'm pretty sure this can be reproduced in all environments, but let me know if you aren't getting obvious errors.

crrobinson14 commented 6 years ago

We're hitting the same issue. Could it be this commit here? https://github.com/mo4islona/node-blockly/commit/0f3940389c1ff4551e7cc5f65b6db3ea48521d2b

Unless I'm misreading this, it looks like a function was added to utils... but the addition was accidentally made inside the body of Blockly.setLocale...

NAllred91 commented 6 years ago

@crrobinson14 You got it.

I added

Blockly.utils.getMessageArray_ = function () {
  return Blockly.Msg
}

to browser.js and it worked in my case.

NAllred91 commented 6 years ago

So I think two changes should be made. one in _blockly.js, moving that function definition out of the setLocale function.

And adding the function definition to browser.js

mo4islona commented 6 years ago

Please check 1.0.29