Skip to content
Snippets Groups Projects
Unverified Commit c40b8c91 authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub
Browse files

Merge pull request #4478 from paulkaplan/hotfix/toolbox-language

[master] Hotfix/toolbox language
parents 11083c1c 984eb1b0
No related branches found
No related tags found
No related merge requests found
...@@ -87,6 +87,7 @@ class Blocks extends React.Component { ...@@ -87,6 +87,7 @@ class Blocks extends React.Component {
componentDidMount () { componentDidMount () {
this.ScratchBlocks.FieldColourSlider.activateEyedropper_ = this.props.onActivateColorPicker; this.ScratchBlocks.FieldColourSlider.activateEyedropper_ = this.props.onActivateColorPicker;
this.ScratchBlocks.Procedures.externalProcedureDefCallback = this.props.onActivateCustomProcedures; this.ScratchBlocks.Procedures.externalProcedureDefCallback = this.props.onActivateCustomProcedures;
this.ScratchBlocks.ScratchMsgs.setLocale(this.props.locale);
const workspaceConfig = defaultsDeep({}, const workspaceConfig = defaultsDeep({},
Blocks.defaultOptions, Blocks.defaultOptions,
...@@ -526,7 +527,7 @@ Blocks.propTypes = { ...@@ -526,7 +527,7 @@ Blocks.propTypes = {
extensionLibraryVisible: PropTypes.bool, extensionLibraryVisible: PropTypes.bool,
isRtl: PropTypes.bool, isRtl: PropTypes.bool,
isVisible: PropTypes.bool, isVisible: PropTypes.bool,
locale: PropTypes.string, locale: PropTypes.string.isRequired,
messages: PropTypes.objectOf(PropTypes.string), messages: PropTypes.objectOf(PropTypes.string),
onActivateColorPicker: PropTypes.func, onActivateColorPicker: PropTypes.func,
onActivateCustomProcedures: PropTypes.func, onActivateCustomProcedures: PropTypes.func,
......
...@@ -24,7 +24,7 @@ describe('Localization', () => { ...@@ -24,7 +24,7 @@ describe('Localization', () => {
await driver.quit(); await driver.quit();
}); });
test('Localization', async () => { test('Switching languages', async () => {
await loadUri(uri); await loadUri(uri);
await clickXpath('//button[@title="Try It"]'); await clickXpath('//button[@title="Try It"]');
...@@ -52,4 +52,15 @@ describe('Localization', () => { ...@@ -52,4 +52,15 @@ describe('Localization', () => {
const logs = await getLogs(); const logs = await getLogs();
await expect(logs).toEqual([]); await expect(logs).toEqual([]);
}); });
// Regression test for #4476, blocks in wrong language when loaded with locale
test('Loading with locale shows correct blocks', async () => {
await loadUri(`${uri}?locale=de`);
await clickXpath('//button[@title="Ausprobieren!"]'); // "Try It"
await clickText('Fühlen'); // Sensing category in German
await new Promise(resolve => setTimeout(resolve, 1000)); // wait for blocks to scroll
await clickText('Antwort'); // Find the "answer" block in German
const logs = await getLogs();
await expect(logs).toEqual([]);
});
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment