You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom language switcher which refreshes the strings (messages) on the blocks. I used it without problems for at least 2 if not 3 years. Just a few days ago, I updated to the most recent version of blockly as I wanted to add support for a new language. In doing so, I found out that the strings for two built-in blocks (controls_whileUntil and controls_flow_statements) are not updated when I change the language; all other blocks are translated correctly.
The translations shown correspond to the default used when the page was loaded and are never updated afterwards for these two blocks.
To enable my own custom language switching, I've edited the language files as follows:
goog.provide('Blockly.Msg.en');//// goog.require('Blockly.Msg');// Blockly.Msg["LOOPS_HUE"] is commented out at bottom for Reeborgfunctionblockly_init_en(){Blockly.Msg["ADD_COMMENT"]="Add Comment";
...
Blockly.Msg["VARIABLES_DYNAMIC_HUE"]="310";}blockly_init_en();
If so, is there a way for me to define equivalent blocks without using the JSON notation as a workaround?
[1] Although, I do not understand how the updating would work when running a local version of my site as mentioned in the edit at the bottom of the bug report.
Yep, that's the same bug. Thanks for pointing out a use case to help us prioritize it.
Until we work out a fix the two ways you could get around it on your end are:
Force a reload with the new language as a query parameter by setting window.location to the current page, but with a different language. This is what Blockly Games does.
Problem statement
I have a custom language switcher which refreshes the strings (messages) on the blocks. I used it without problems for at least 2 if not 3 years. Just a few days ago, I updated to the most recent version of blockly as I wanted to add support for a new language. In doing so, I found out that the strings for two built-in blocks (
controls_whileUntil
andcontrols_flow_statements
) are not updated when I change the language; all other blocks are translated correctly.The translations shown correspond to the default used when the page was loaded and are never updated afterwards for these two blocks.
Expected Behavior
Correct behaviour as seen on (old "stable/public" version) http://reeborg.ca/reeborg.html
Loading the page for the first time; the default language is English:
Switching to French:
Note that the bottom two blocks shown are translated correctly.
Actual Behavior
Newer (testing) version; starting in English (https://aroberge.github.io/reeborg-staging/)
Switching to French:
Note that the bottom block is not translated; the one above is is only partially translated.
When a user select a language, I save it in localStorage. Upon reloading the page, the correct translation are shown:
Steps to Reproduce
See above
Stack Traces
None
Operating System and Browser
I have only tested on Windows 10. I see this problem using the latest versions of Chrome, Firefox and Edge.
Additional Information
To use blockly, I simply copied the compressed version and other relevant files from your repository. https://github.com/aroberge/reeborg/blob/master/reeborg.html#L603
To enable my own custom language switching, I've edited the language files as follows:
(See https://github.com/aroberge/reeborg/tree/master/src/blockly_msg)
When switching to a different language, I simply call the relevant
blockly_init_xx()
.Edit
When I run the program locally (using https://github.com/aroberge/reeborg/blob/master/serve_reeborg.py), the two blocks get updated correctly when I switch language.
The text was updated successfully, but these errors were encountered: