diff --git a/package.json b/package.json
index eab6f06..40416a2 100644
--- a/package.json
+++ b/package.json
@@ -109,7 +109,7 @@
"rimraf": "^2.6.1",
"scratch-audio": "0.1.0-prerelease.20200528195344",
"scratch-blocks": "0.1.0-prerelease.20210829081240",
- "scratch-l10n":"github:open-scratch/easy-scratch-l10n#simplify",
+ "scratch-l10n": "3.14.20210922031532",
"scratch-paint": "0.2.0-prerelease.20210907080144",
"scratch-render": "0.1.0-prerelease.20210819221425",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003",
diff --git a/src/components/menu-bar/profile-button.css b/src/components/menu-bar/custom-button.css
similarity index 83%
rename from src/components/menu-bar/profile-button.css
rename to src/components/menu-bar/custom-button.css
index 866334f..a36944c 100644
--- a/src/components/menu-bar/profile-button.css
+++ b/src/components/menu-bar/custom-button.css
@@ -1,6 +1,6 @@
@import "../../css/colors.css";
-.profile-button {
+.custom-button {
/* background: $data-primary; */
margin: 0 10px;
}
\ No newline at end of file
diff --git a/src/components/menu-bar/profile-button.jsx b/src/components/menu-bar/custom-button.jsx
similarity index 68%
rename from src/components/menu-bar/profile-button.jsx
rename to src/components/menu-bar/custom-button.jsx
index 1d08615..a8d0f62 100644
--- a/src/components/menu-bar/profile-button.jsx
+++ b/src/components/menu-bar/custom-button.jsx
@@ -4,9 +4,9 @@ import PropTypes from 'prop-types';
import React from 'react';
import Button from '../button/button.jsx';
-import styles from './profile-button.css';
+import styles from './custom-button.css';
-const ProfileButton = ({
+const CustomButton = ({
className,
style,
onClick,
@@ -15,23 +15,23 @@ const ProfileButton = ({
);
-ProfileButton.propTypes = {
+CustomButton.propTypes = {
className: PropTypes.string,
onClick: PropTypes.func,
buttonName: PropTypes.string
};
-ProfileButton.defaultProps = {
+CustomButton.defaultProps = {
onClick: () => {}
};
-export default ProfileButton;
+export default CustomButton;
diff --git a/src/components/menu-bar/menu-bar.jsx b/src/components/menu-bar/menu-bar.jsx
index 26a24c0..80c33d2 100644
--- a/src/components/menu-bar/menu-bar.jsx
+++ b/src/components/menu-bar/menu-bar.jsx
@@ -13,7 +13,7 @@ import Box from '../box/box.jsx';
import Button from '../button/button.jsx';
import CommunityButton from './community-button.jsx';
import ShareButton from './share-button.jsx';
-import ProfileButton from './profile-button.jsx';
+import CustomButton from './custom-button.jsx';
import {ComingSoonTooltip} from '../coming-soon/coming-soon.jsx';
import Divider from '../divider/divider.jsx';
import LanguageSelector from '../../containers/language-selector.jsx';
@@ -412,7 +412,9 @@ class MenuBar extends React.Component {
/>
)}
- {(this.props.canChangeLanguage) && (
@@ -620,7 +622,7 @@ class MenuBar extends React.Component {
{
- (window.scratchConfig && window.scratchConfig.profileButton && window.scratchConfig.profileButton.show) && (
{
@@ -634,13 +636,15 @@ class MenuBar extends React.Component {
(window.scratchConfig && window.scratchConfig.menuBar && window.scratchConfig.menuBar.customButtons && window.scratchConfig.menuBar.customButtons.length>0) && (
window.scratchConfig.menuBar.customButtons.map(item=> {
if(item.show){
- return {item.handleClick();}}
+ onClick = {item.handleClick}
buttonName = {item.buttonName}
/>
+ }else{
+ return ""
}
})
)
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, //是否显示
diff --git a/yarn.lock b/yarn.lock
index e865db5..d8ae604 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3269,15 +3269,6 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"
-"scratch-l10n@github:open-scratch/easy-scratch-l10n#simplify":
- version "3.14.0"
- resolved "https://codeload.github.com/open-scratch/easy-scratch-l10n/tar.gz/7f4c97e8ac32122f17ee9a0e6a70b246d2b9f4eb"
- dependencies:
- "@babel/cli" "^7.1.2"
- "@babel/core" "^7.1.2"
- babel-plugin-react-intl "^3.0.1"
- transifex "1.6.6"
-
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
@@ -8653,6 +8644,16 @@ scratch-l10n@3.14.20210829031508:
babel-plugin-react-intl "^3.0.1"
transifex "1.6.6"
+scratch-l10n@3.14.20210922031532:
+ version "3.14.20210922031532"
+ resolved "https://registry.yarnpkg.com/scratch-l10n/-/scratch-l10n-3.14.20210922031532.tgz#8c41da4170ec2c91c455688ba80926fbc9dbb81f"
+ integrity sha512-LxwHhsxkZR5veFpDMC8wAItGMKVj8+Q33B5RiqWhH/zzx5Qq7/ON9AyGOZ0NF736U70TqjWvV1ZX4lP+GsEjBg==
+ dependencies:
+ "@babel/cli" "^7.1.2"
+ "@babel/core" "^7.1.2"
+ babel-plugin-react-intl "^3.0.1"
+ transifex "1.6.6"
+
scratch-paint@0.2.0-prerelease.20210907080144:
version "0.2.0-prerelease.20210907080144"
resolved "https://registry.yarnpkg.com/scratch-paint/-/scratch-paint-0.2.0-prerelease.20210907080144.tgz#6b14768c5ff9f63ae1a986888f6fec2fb82a99de"
@@ -9897,9 +9898,9 @@ urix@^0.1.0:
integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=
url-parse@^1.4.3, url-parse@^1.5.3:
- version "1.5.3"
- resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862"
- integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==
+ version "1.5.10"
+ resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1"
+ integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"