Basic RTL
This commit is contained in:
1 parent
2b413ca001
commit
375e9c3f07
4 files changed
+15
-1
No files matched your search
@@ -65,6 +65,7 @@ const GUIComponent = props => {
|
||||
importInfoVisible,
|
||||
intl,
|
||||
isPlayerOnly,
|
||||
isRtl,
|
||||
loading,
|
||||
onExtensionButtonClick,
|
||||
onActivateCostumesTab,
|
||||
@@ -110,6 +111,7 @@ const GUIComponent = props => {
|
||||
) : (
|
||||
<Box
|
||||
className={styles.pageWrapper}
|
||||
dir={isRtl ? 'rtl' : 'ltr'}
|
||||
{...componentProps}
|
||||
>
|
||||
{previewInfoVisible ? (
|
||||
@@ -282,6 +284,7 @@ GUIComponent.propTypes = {
|
||||
importInfoVisible: PropTypes.bool,
|
||||
intl: intlShape.isRequired,
|
||||
isPlayerOnly: PropTypes.bool,
|
||||
isRtl: PropTypes.bool,
|
||||
loading: PropTypes.bool,
|
||||
onActivateCostumesTab: PropTypes.func,
|
||||
onActivateSoundsTab: PropTypes.func,
|
||||
|
||||
@@ -77,7 +77,7 @@ class Blocks extends React.Component {
|
||||
const workspaceConfig = defaultsDeep({},
|
||||
Blocks.defaultOptions,
|
||||
this.props.options,
|
||||
{toolbox: this.props.toolboxXML}
|
||||
{rtl: this.props.isRtl, toolbox: this.props.toolboxXML}
|
||||
);
|
||||
this.workspace = this.ScratchBlocks.inject(this.blocks, workspaceConfig);
|
||||
|
||||
@@ -403,6 +403,7 @@ class Blocks extends React.Component {
|
||||
options,
|
||||
stageSize,
|
||||
vm,
|
||||
isRtl,
|
||||
isVisible,
|
||||
onActivateColorPicker,
|
||||
updateToolboxState,
|
||||
@@ -467,6 +468,7 @@ Blocks.propTypes = {
|
||||
anyModalVisible: PropTypes.bool,
|
||||
customProceduresVisible: PropTypes.bool,
|
||||
extensionLibraryVisible: PropTypes.bool,
|
||||
isRtl: PropTypes.bool,
|
||||
isVisible: PropTypes.bool,
|
||||
locale: PropTypes.string,
|
||||
messages: PropTypes.objectOf(PropTypes.string),
|
||||
@@ -541,6 +543,7 @@ const mapStateToProps = state => ({
|
||||
state.scratchGui.mode.isFullScreen
|
||||
),
|
||||
extensionLibraryVisible: state.scratchGui.modals.extensionLibrary,
|
||||
isRtl: state.locales.isRtl,
|
||||
locale: state.locales.locale,
|
||||
messages: state.locales.messages,
|
||||
toolboxXML: state.scratchGui.toolbox.toolboxXML,
|
||||
|
||||
@@ -113,6 +113,7 @@ const mapStateToProps = state => ({
|
||||
costumesTabVisible: state.scratchGui.editorTab.activeTabIndex === COSTUMES_TAB_INDEX,
|
||||
importInfoVisible: state.scratchGui.modals.importInfo,
|
||||
isPlayerOnly: state.scratchGui.mode.isPlayerOnly,
|
||||
isRtl: state.locales.isRtl,
|
||||
loadingStateVisible: state.scratchGui.modals.loadingProject,
|
||||
previewInfoVisible: state.scratchGui.modals.previewInfo,
|
||||
targetIsStage: (
|
||||
|
||||
@@ -9,22 +9,28 @@ const UPDATE_LOCALES = 'scratch-gui/locales/UPDATE_LOCALES';
|
||||
const SELECT_LOCALE = 'scratch-gui/locales/SELECT_LOCALE';
|
||||
|
||||
const initialState = {
|
||||
isRtl: false,
|
||||
locale: 'en',
|
||||
messagesByLocale: editorMessages,
|
||||
messages: editorMessages.en
|
||||
};
|
||||
|
||||
// TODO: this probably should be coming from scratch-l10n
|
||||
const RtlLangs = ['he'];
|
||||
|
||||
const reducer = function (state, action) {
|
||||
if (typeof state === 'undefined') state = initialState;
|
||||
switch (action.type) {
|
||||
case SELECT_LOCALE:
|
||||
return Object.assign({}, state, {
|
||||
isRtl: RtlLangs.indexOf(action.locale) !== -1,
|
||||
locale: action.locale,
|
||||
messagesByLocale: state.messagesByLocale,
|
||||
messages: state.messagesByLocale[action.locale]
|
||||
});
|
||||
case UPDATE_LOCALES:
|
||||
return Object.assign({}, state, {
|
||||
isRtl: state.isRtl,
|
||||
locale: state.locale,
|
||||
messagesByLocale: action.messagesByLocale,
|
||||
messages: action.messagesByLocale[state.locale]
|
||||
@@ -53,6 +59,7 @@ const initLocale = function (currentState, locale) {
|
||||
{},
|
||||
currentState,
|
||||
{
|
||||
isRtl: RtlLangs.indexOf(locale) !== -1,
|
||||
locale: locale,
|
||||
messagesByLocale: currentState.messagesByLocale,
|
||||
messages: currentState.messagesByLocale[locale]
|
||||
|
||||
Reference in new issue
Block a user