diff --git a/src/components/menu-bar/menu-bar.jsx b/src/components/menu-bar/menu-bar.jsx
index 253d961..80c33d2 100644
--- a/src/components/menu-bar/menu-bar.jsx
+++ b/src/components/menu-bar/menu-bar.jsx
@@ -412,7 +412,9 @@ class MenuBar extends React.Component {
/>
)}
- {(this.props.canChangeLanguage) && (
diff --git a/src/lib/app-state-hoc.jsx b/src/lib/app-state-hoc.jsx
index f7afcb9..75bb2dd 100644
--- a/src/lib/app-state-hoc.jsx
+++ b/src/lib/app-state-hoc.jsx
@@ -31,7 +31,15 @@ const AppStateHOC = function (WrappedComponent, localesOnly) {
let enhancer;
let initializedLocales = localesInitialState;
- const locale = detectLocale(Object.keys(locales));
+ let locale;
+ if(window.scratchConfig && window.scratchConfig.menuBar && window.scratchConfig.menuBar.languageButton &&
+ window.scratchConfig.menuBar.languageButton.defaultLanguage){
+ window.scratchConfig.menuBar.languageButton.defaultLanguage
+ locale = window.scratchConfig.menuBar.languageButton.defaultLanguage
+ }else{
+ locale = detectLocale(Object.keys(locales));
+ }
+
if (locale !== 'en') {
initializedLocales = initLocale(initializedLocales, locale);
}
@@ -103,6 +111,8 @@ const AppStateHOC = function (WrappedComponent, localesOnly) {
var event = new CustomEvent('setFullScreen', {"detail": {isFullScreen: isFullScreen}});
document.dispatchEvent(event);
}
+
+
}
componentDidUpdate (prevProps) {
if (localesOnly) return;
diff --git a/src/playground/index.ejs b/src/playground/index.ejs
index 76c4e24..947cc49 100644
--- a/src/playground/index.ejs
+++ b/src/playground/index.ejs
@@ -28,6 +28,11 @@
style: {
background: 'hsla(215, 100%, 65%, 1)',
},
+ //切换语言按钮
+ languageButton:{
+ show: true, //是否显示
+ defaultLanguage: 'zh-cn' //默认语言 en zh-cn zh-tw
+ },
//新建按钮
newButton:{
show: true, //是否显示