Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/scratch-gui/src/exported-reducers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ScratchPaintReducer} from 'scratch-paint';
import LocalesReducer, {localesInitialState, initLocale} from './reducers/locales.js';
import LocalesReducer, {localesInitialState, initLocale, selectLocale} from './reducers/locales.js';
import GuiReducer, {buildInitialState, guiMiddleware, initEmbedded, initFullScreen, initPlayer} from './reducers/gui';
import {setFullScreen, setPlayer, setEmbedded} from './reducers/mode.js';
import {activateDeck} from './reducers/cards.js';
Expand Down Expand Up @@ -49,5 +49,6 @@ export {
setFullScreen,
setPlayer,
setEmbedded,
activateDeck
activateDeck,
selectLocale
};
9 changes: 3 additions & 6 deletions packages/scratch-gui/src/lib/app-state-provider-hoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import PropTypes from 'prop-types';

import {EditorState} from './editor-state';
import {setPlayer, setFullScreen, setEmbedded} from '../reducers/mode.js';
import ConnectedIntlProvider from './connected-intl-provider.jsx';

/**
* Wraps the editor into the redux state contained within an EditorState instance.
Expand Down Expand Up @@ -39,11 +38,9 @@ export const AppStateProviderHOC = function (WrappedComponent) {
} = this.props;
return (
<Provider store={appState.store}>
<ConnectedIntlProvider>
<WrappedComponent
{...componentProps}
/>
</ConnectedIntlProvider>
<WrappedComponent
{...componentProps}
/>
</Provider>
);
}
Expand Down
11 changes: 10 additions & 1 deletion packages/scratch-gui/src/lib/editor-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface EditorStateParams {
isPlayerOnly?: boolean;
showTelemetryModal?: boolean;
isEmbedded?: boolean;
locale?: string;
}

/**
Expand All @@ -40,10 +41,18 @@ export class EditorState {
let enhancer;

let initializedLocales = localesInitialState;
const locale = detectLocale(Object.keys(locales));

let locale = 'en';
if (params.locale && Object.keys(locales).includes(params.locale)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember we talked about having a console.warn if Object.keys(locales).includes(params.locale) is false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about it. Will add it

locale = params.locale;
} else {
locale = detectLocale(Object.keys(locales));
}

if (locale !== 'en') {
initializedLocales = initLocale(initializedLocales, locale);
}

if (params.localesOnly) {
// Used for instantiating minimal state for the unsupported
// browser modal
Expand Down