From c24f90eae149acf204605ed0df628a4801944b87 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 02:24:38 -0700 Subject: [PATCH 01/18] adding localization usingFpormatted Messages --- package-lock.json | 81 +++++++++++++++++++++++-- package.json | 3 +- src/view/components/toolbar/ToolBar.tsx | 27 +++++++-- src/view/index.tsx | 19 +++--- 4 files changed, 112 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index db65b318b..c2bf820e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1137,6 +1137,11 @@ "integrity": "sha512-6It2EVfGskxZCQhuykrfnALg7oVeiI6KclWSmGDqB0AiInVrTGB9Jp9i4/Ad21u9Jde/voVQz6eFX/eSg/UsPA==", "dev": true }, + "@formatjs/intl-relativetimeformat": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-2.8.0.tgz", + "integrity": "sha512-5T3m5hJSxXrbwtnFHyYBSbTjOXPXu+4NJ0MUu1LAf4fPEdd+pJZfWKuMJSWgFQPVMbLYq9NLvDWQda3hVe99sg==" + }, "@gulp-sourcemaps/identity-map": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/identity-map/-/identity-map-1.0.2.tgz", @@ -1725,6 +1730,20 @@ "@types/node": "*" } }, + "@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "requires": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, + "@types/invariant": { + "version": "2.2.30", + "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.30.tgz", + "integrity": "sha512-98fB+yo7imSD2F7PF7GIpELNgtLNgo5wjivu0W5V4jx+KVVJxo6p/qN4zdzSTBWy4/sN3pPyXwnhRSD28QX+ag==" + }, "@types/istanbul-lib-coverage": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", @@ -1778,8 +1797,7 @@ "@types/prop-types": { "version": "15.7.1", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.1.tgz", - "integrity": "sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg==", - "dev": true + "integrity": "sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg==" }, "@types/q": { "version": "1.5.2", @@ -1791,7 +1809,6 @@ "version": "16.8.18", "resolved": "https://registry.npmjs.org/@types/react/-/react-16.8.18.tgz", "integrity": "sha512-lUXdKzRqWR4FebR5tGHkLCqnvQJS4fdXKCBrNGGbglqZg2gpU+J82pMONevQODUotATs9fc9k66bx3/St8vReg==", - "dev": true, "requires": { "@types/prop-types": "*", "csstype": "^2.2.0" @@ -5007,8 +5024,7 @@ "csstype": { "version": "2.6.5", "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.5.tgz", - "integrity": "sha512-JsTaiksRsel5n7XwqPAfB0l3TFKdpjW/kgAELf9vrb5adGA7UCPLajKK5s3nFrcFm3Rkyp/Qkgl73ENc1UY3cA==", - "dev": true + "integrity": "sha512-JsTaiksRsel5n7XwqPAfB0l3TFKdpjW/kgAELf9vrb5adGA7UCPLajKK5s3nFrcFm3Rkyp/Qkgl73ENc1UY3cA==" }, "cyclist": { "version": "0.2.2", @@ -8468,6 +8484,14 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "hoist-non-react-statics": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz", + "integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==", + "requires": { + "react-is": "^16.7.0" + } + }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -8928,11 +8952,34 @@ "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", "dev": true }, + "intl-format-cache": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-4.1.13.tgz", + "integrity": "sha512-d/1NI8ctPZsPJU3G6k0pIuydnebeck7hG+wIHJOJUJm3eZ2+3bcZCD34o/Mc18M5ZiEZei02xsMtp8g1IQc23A==" + }, + "intl-locales-supported": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/intl-locales-supported/-/intl-locales-supported-1.4.5.tgz", + "integrity": "sha512-D7oriM5x46rd7kNlSW0f9noIBegFr3ReIM6xlMpwH4lfIPD/zvBelPlCjR10IK16boGJG9lKccOvRAM8wzpbrA==" + }, + "intl-messageformat": { + "version": "6.1.9", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-6.1.9.tgz", + "integrity": "sha512-vnPujdP+gpWK/+GxWUo3nWRfrUj67/NAZoBNAyCvZ0fnfWh5jvIkKNr5ZZYewdZ7J3cEFLU6hYYgWztiCEFZGg==", + "requires": { + "intl-format-cache": "^4.1.13", + "intl-messageformat-parser": "^3.0.7" + } + }, + "intl-messageformat-parser": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-3.0.7.tgz", + "integrity": "sha512-L16VbbV3NFaiZV65XwOIH9fBe52TS2EkOR0k8Y4ratsgTE7KPEbcUCUrz/iEQwJo7BcWY4ohkZbeYZRgAiPR1Q==" + }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dev": true, "requires": { "loose-envify": "^1.0.0" } @@ -17420,6 +17467,23 @@ "integrity": "sha512-X1Y+0jR47ImDVr54Ab6V9eGk0Hnu7fVWGeHQSOXHf/C2pF9c6uy3gef8QUeuUiWlNb0i08InPSE5a/KJzNzw1Q==", "dev": true }, + "react-intl": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-3.1.9.tgz", + "integrity": "sha512-mQxhcFsYsj7O+k2Gsf1p+QaGhEdr+g7v5hYaa88dqar1m1xdWldEJjZ4JK/waHTp4zhVPoco4NQ1JdPkhs8HkA==", + "requires": { + "@formatjs/intl-relativetimeformat": "^2.6.3", + "@types/hoist-non-react-statics": "^3.3.1", + "@types/invariant": "^2.2.30", + "hoist-non-react-statics": "^3.3.0", + "intl-format-cache": "^4.1.10", + "intl-locales-supported": "^1.4.5", + "intl-messageformat": "^6.1.6", + "intl-messageformat-parser": "^3.0.7", + "invariant": "^2.1.1", + "shallow-equal": "^1.1.0" + } + }, "react-is": { "version": "16.8.6", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", @@ -18546,6 +18610,11 @@ } } }, + "shallow-equal": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.0.tgz", + "integrity": "sha512-Z21pVxR4cXsfwpMKMhCEIO1PCi5sp7KEp+CmOpBQ+E8GpHwKOw2sEzk7sgblM3d/j4z4gakoWEoPcjK0VJQogA==" + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", diff --git a/package.json b/package.json index 373699ddf..7c428df3f 100644 --- a/package.json +++ b/package.json @@ -297,6 +297,7 @@ "os": "^0.1.1", "react": "^16.8.6", "react-dom": "^16.8.6", + "react-intl": "^3.1.9", "socket.io": "^2.2.0", "svg-inline-react": "^3.1.0", "util": "^0.12.1", @@ -309,4 +310,4 @@ "extensionDependencies": [ "ms-python.python" ] -} \ No newline at end of file +} diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index 5beaf50aa..7d0abf89c 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -12,6 +12,7 @@ import { } from "./sensorModalUtils"; import { INFO_SVG } from "../../svgs/info_svg"; import { CONSTANTS } from "../../constants"; +import { FormattedMessage, injectIntl } from "react-intl"; interface IToolbarState { currentOpenedLabel: string; @@ -242,17 +243,35 @@ class ToolBar extends React.Component {
- {content["descriptionTitle"]} + {content["tagInput"]} {content["tagOutput"]}

-
{content["descriptionText"]}
+
+ +
-
{content["tryItTitle"]}
+
+ +

-
{content["tryItDescriptrion"]}
+
+ +
{component}
diff --git a/src/view/index.tsx b/src/view/index.tsx index 78a8cc933..8af89af9e 100644 --- a/src/view/index.tsx +++ b/src/view/index.tsx @@ -1,13 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import App from './App'; +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import App from "./App"; +import { IntlProvider } from "react-intl"; -import './index.css'; +import "./index.css"; + +const locale = "en-US"; ReactDOM.render( - , - document.getElementById('root') -); \ No newline at end of file + + + , + document.getElementById("root") +); From de376a0ad8c85f871b9d5255ce9c73ed27cf7046 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 02:26:47 -0700 Subject: [PATCH 02/18] changing locale --- src/view/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/index.tsx b/src/view/index.tsx index 8af89af9e..4150ddac4 100644 --- a/src/view/index.tsx +++ b/src/view/index.tsx @@ -8,7 +8,7 @@ import { IntlProvider } from "react-intl"; import "./index.css"; -const locale = "en-US"; +const locale = "en"; ReactDOM.render( From a1a4f3fdbdc51be11ae7ffa9612a7ded95f10e60 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 02:42:49 -0700 Subject: [PATCH 03/18] restore injectintl --- src/view/components/toolbar/ToolBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index 7d0abf89c..d906d86cb 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -341,4 +341,4 @@ class ToolBar extends React.Component { }; } -export default ToolBar; +export default injectIntl(ToolBar); From 7a7dcef89599cbd24412c817c745e718b5b9e7af Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 03:23:56 -0700 Subject: [PATCH 04/18] renameopenedlabel to opened id --- src/view/components/toolbar/ToolBar.tsx | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index d906d86cb..e07df459c 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -15,7 +15,7 @@ import { CONSTANTS } from "../../constants"; import { FormattedMessage, injectIntl } from "react-intl"; interface IToolbarState { - currentOpenedLabel: string; + currentOpenedId: string; doNotShowAgain: boolean; showModal: boolean; showRedirectModal: boolean; @@ -28,7 +28,7 @@ class ToolBar extends React.Component { constructor(props: any) { super(props); this.state = { - currentOpenedLabel: "", + currentOpenedId: "", doNotShowAgain: false, showModal: false, showRedirectModal: false @@ -188,13 +188,13 @@ class ToolBar extends React.Component { ) => { if ( !this.state.showModal && - this.state.currentOpenedLabel === "" && - this.state.currentOpenedLabel !== label + this.state.currentOpenedId === "" && + this.state.currentOpenedId !== label ) { this.openModal(label); } else { this.closeCurrentModal(); - if (this.state.currentOpenedLabel !== label) { + if (this.state.currentOpenedId !== label) { this.openModal(label); } } @@ -209,16 +209,16 @@ class ToolBar extends React.Component { } } private closeCurrentModal = () => { - this.changePressedState(this.state.currentOpenedLabel, false); + this.changePressedState(this.state.currentOpenedId, false); this.setState({ - currentOpenedLabel: "", + currentOpenedId: "", showModal: false }); }; private openModal = (label: string) => { this.setState({ - currentOpenedLabel: label, + currentOpenedId: label, showModal: true }); this.changePressedState(label, true); @@ -227,13 +227,13 @@ class ToolBar extends React.Component { private getIconModal() { if ( !this.state.showModal || - !LABEL_TO_MODAL_CONTENT.get(this.state.currentOpenedLabel) + !LABEL_TO_MODAL_CONTENT.get(this.state.currentOpenedId) ) { return null; } const content = LABEL_TO_MODAL_CONTENT.get( - this.state.currentOpenedLabel + this.state.currentOpenedId ) as IModalContent; const component = content @@ -244,7 +244,7 @@ class ToolBar extends React.Component {
{content["tagInput"]} @@ -254,21 +254,21 @@ class ToolBar extends React.Component {

From 00a431c9250f2890fb97f89420206bd90c7614a7 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 03:37:44 -0700 Subject: [PATCH 05/18] adding translation file --- src/view/components/toolbar/ToolBar.tsx | 6 +-- .../components/toolbar/sensorModalUtils.tsx | 2 +- src/view/translation/en.json | 54 +++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 src/view/translation/en.json diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index e07df459c..4008870ca 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -244,7 +244,7 @@ class ToolBar extends React.Component {
{content["tagInput"]} @@ -254,14 +254,14 @@ class ToolBar extends React.Component {
diff --git a/src/view/components/toolbar/sensorModalUtils.tsx b/src/view/components/toolbar/sensorModalUtils.tsx index e5dbdd71e..91cae2717 100644 --- a/src/view/components/toolbar/sensorModalUtils.tsx +++ b/src/view/components/toolbar/sensorModalUtils.tsx @@ -46,7 +46,7 @@ export const TOOLBAR_ICON_ID = { SOUND: "toolbar-sound-sensor", SPEAKER: "toolbar-speaker", SWITCH: "toolbar-slider-switch", - TEMPERATURE: "toolbar-temperatur-sensor" + TEMPERATURE: "toolbar-temperature-sensor" }; export interface IModalContent { diff --git a/src/view/translation/en.json b/src/view/translation/en.json new file mode 100644 index 000000000..3d664bf38 --- /dev/null +++ b/src/view/translation/en.json @@ -0,0 +1,54 @@ +{ + "toolbar-gpio.title": "", + "toolbar-ir-sensor.title": "", + "left-edge.title": "", + "toolbar-light-sensor.title": "", + "toolbar-motion-sensor.title": "", + "toolbar-neo-pixels.title": "", + "toolbar-push-button.title": "", + "toolbar-red-led.title": "", + "right-edge.title": "", + "toolbar-sound-sensor.title": "", + "toolbar-speaker.title": "", + "toolbar-slider-switch.title": "", + "toolbar-temperature-sensor.title": "", + "toolbar-gpio.description": "", + "toolbar-ir-sensor.description": "", + "left-edge.description": "", + "toolbar-light-sensor.description": "", + "toolbar-motion-sensor.description": "", + "toolbar-neo-pixels.description": "", + "toolbar-push-button.description": "", + "toolbar-red-led.description": "", + "right-edge.description": "", + "toolbar-sound-sensor.description": "", + "toolbar-speaker.description": "", + "toolbar-slider-switch.description": "", + "toolbar-temperature-sensor.description": "", + "toolbar-gpio.tryItTitle": "", + "toolbar-ir-sensor.tryItTitle": "", + "left-edge.tryItTitle": "", + "toolbar-light-sensor.tryItTitle": "", + "toolbar-motion-sensor.tryItTitle": "", + "toolbar-neo-pixels.tryItTitle": "", + "toolbar-push-button.tryItTitle": "", + "toolbar-red-led.tryItTitle": "", + "right-edge.tryItTitle": "", + "toolbar-sound-sensor.tryItTitle": "", + "toolbar-speaker.tryItTitle": "", + "toolbar-slider-switch.tryItTitle": "", + "toolbar-temperature-sensor.tryItTitle": "", + "toolbar-gpio.tryItDescriptrion": "", + "toolbar-ir-sensor.tryItDescriptrion": "", + "left-edge.tryItDescriptrion": "", + "toolbar-light-sensor.tryItDescriptrion": "", + "toolbar-motion-sensor.tryItDescriptrion": "", + "toolbar-neo-pixels.tryItDescriptrion": "", + "toolbar-push-button.tryItDescriptrion": "", + "toolbar-red-led.tryItDescriptrion": "", + "right-edge.tryItDescriptrion": "", + "toolbar-sound-sensor.tryItDescriptrion": "", + "toolbar-speaker.tryItDescriptrion": "", + "toolbar-slider-switch.tryItDescriptrion": "", + "toolbar-temperature-sensor.tryItDescriptrion": "" +} From a449ab306eafe09121f444df31d3d6fa206eb19b Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 12:56:53 -0700 Subject: [PATCH 06/18] adding manager --- package-lock.json | 205 ++++++++++++++---- package.json | 3 + scripts/manageTranslations.js | 77 +++++++ src/translations/en.json | 36 +++ src/view/components/toolbar/ToolBar.tsx | 1 + .../components/toolbar/sensorModalUtils.tsx | 8 +- src/view/translation/en.json | 54 ----- 7 files changed, 287 insertions(+), 97 deletions(-) create mode 100644 scripts/manageTranslations.js create mode 100644 src/translations/en.json delete mode 100644 src/view/translation/en.json diff --git a/package-lock.json b/package-lock.json index c2bf820e2..ea3f3f06d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1308,6 +1308,15 @@ "supports-color": "^5.3.0" } }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -3547,6 +3556,17 @@ "ssri": "^6.0.1", "unique-filename": "^1.1.1", "y18n": "^4.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "cache-base": { @@ -4225,6 +4245,17 @@ "mkdirp": "^0.5.1", "rimraf": "^2.5.4", "run-queue": "^1.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "copy-descriptor": { @@ -5270,6 +5301,15 @@ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } } } }, @@ -6006,6 +6046,17 @@ "object-assign": "^4.0.1", "object-hash": "^1.1.4", "rimraf": "^2.6.1" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "eslint-module-utils": { @@ -6970,6 +7021,17 @@ "flatted": "^2.0.0", "rimraf": "2.6.3", "write": "1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "flatted": { @@ -7189,8 +7251,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -7211,14 +7272,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7233,20 +7292,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -7363,8 +7419,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -7376,7 +7431,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7391,7 +7445,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -7399,14 +7452,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -7425,7 +7476,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7506,8 +7556,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -7519,7 +7568,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7605,8 +7653,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -7642,7 +7689,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7662,7 +7708,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7706,14 +7751,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -9418,6 +9461,17 @@ "make-dir": "^2.1.0", "rimraf": "^2.6.3", "source-map": "^0.6.1" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "istanbul-reports": { @@ -11598,6 +11652,17 @@ "mkdirp": "^0.5.1", "rimraf": "^2.5.4", "run-queue": "^1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "ms": { @@ -17484,6 +17549,49 @@ "shallow-equal": "^1.1.0" } }, + "react-intl-translations-manager": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/react-intl-translations-manager/-/react-intl-translations-manager-5.0.3.tgz", + "integrity": "sha512-EfBeugnOGFcdUbQyY9TqBMbuauQ8wm73ZqFr0UqCljhbXl7YDHQcVzclWFRkVmlUffzxitLQFhAZEVVeRNQSwA==", + "dev": true, + "requires": { + "chalk": "^2.3.2", + "glob": "^7.1.2", + "json-stable-stringify": "^1.0.1", + "mkdirp": "^0.5.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "react-is": { "version": "16.8.6", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", @@ -18201,15 +18309,6 @@ "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=", "dev": true }, - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", @@ -20114,6 +20213,23 @@ "integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==", "dev": true }, + "typescript-react-intl": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/typescript-react-intl/-/typescript-react-intl-0.4.0.tgz", + "integrity": "sha512-sCQN2YdWSaWNAK9bBezmqZStswfh0MMWQnIlBOn+iFBN4fE1m36fv1zqUaw33jTbQUjIaZ4N+NFbMfS/cnyIew==", + "dev": true, + "requires": { + "typescript": "^2.6.2" + }, + "dependencies": { + "typescript": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "dev": true + } + } + }, "uc.micro": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", @@ -21205,6 +21321,17 @@ "p-map": "^1.1.1", "pify": "^3.0.0", "rimraf": "^2.2.8" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "globby": { diff --git a/package.json b/package.json index 7c428df3f..bdadeb096 100644 --- a/package.json +++ b/package.json @@ -250,6 +250,7 @@ "lint": "tslint -c tslint.json src/**/*.{ts,tsx}", "format": "prettier --write src/**/*.{ts,tsx}", "tslint-check": "tslint-config-prettier-check ./tslint.json", + "manage:translations": "node scripts/manageTranslations.js", "package": "vsce package" }, "devDependencies": { @@ -272,6 +273,7 @@ "less-loader": "^4.1.0", "mocha": "^6.1.4", "npm-run-all": "^4.1.3", + "react-intl-translations-manager": "^5.0.3", "react-scripts": "3.0.1", "style-loader": "^0.21.0", "ts-import-plugin": "^1.5.4", @@ -282,6 +284,7 @@ "tslint-react": "^3.6.0", "tslint-react-hooks": "^2.0.0", "typescript": "^3.3.1", + "typescript-react-intl": "^0.4.0", "vsce": "^1.47.0", "vscode-nls-dev": "^3.2.6", "vscode-test": "^1.0.0", diff --git a/scripts/manageTranslations.js b/scripts/manageTranslations.js new file mode 100644 index 000000000..aae4ad17d --- /dev/null +++ b/scripts/manageTranslations.js @@ -0,0 +1,77 @@ +// This script was taken from https://github.com/bang88/typescript-react-intl/issues/19, it is used to extract strings +// to be localized from typescript source to .json resource files + +// For default languages and languages use the VSCode language codes. +// A list of all locales supported by VSCode can be found here: https://code.visualstudio.com/docs/getstarted/locales + +const DEFAULT_LANGUAGE = "en"; // for the default language, everything is automatically whitelisted +const LANGUAGES = []; // translations to generate---don't include the default language +const TARGET_DIRECTORY = "src/translations"; +const EXTRACT_MESSAGE_FILE_PATTERN = "src/**/*.@(tsx|ts)"; + +const TEMP_DIR = "./temp"; +const TEMP_MESSAGE_FILENAME = "allMessages.json"; + +const fs = require("fs"); +const path = require("path"); +const glob = require("glob"); +const rimraf = require("rimraf"); +const parser = require("typescript-react-intl").default; +const manageTranslations = require("react-intl-translations-manager").default; +const { + readMessageFiles, + getDefaultMessages +} = require("react-intl-translations-manager"); + +function extractTranslations(pattern, cb) { + let results = []; + pattern = pattern || "src/**/*.@(tsx|ts)"; + glob(pattern, function(err, files) { + if (err) { + throw new Error(err); + } + files.forEach(function(f) { + const contents = fs.readFileSync(f).toString(); + const res = parser(contents); + results = results.concat(res); + }); + + cb && cb(results); + }); +} + +if (!fs.existsSync(TEMP_DIR)) { + fs.mkdirSync(TEMP_DIR); +} + +const tempMessageFilePath = path.join(TEMP_DIR, TEMP_MESSAGE_FILENAME); + +extractTranslations(EXTRACT_MESSAGE_FILE_PATTERN, function(messages) { + fs.writeFileSync(tempMessageFilePath, JSON.stringify(messages, null, 2)); + + manageTranslations({ + messagesDirectory: TEMP_DIR, + translationsDirectory: TARGET_DIRECTORY, + languages: [DEFAULT_LANGUAGE, ...LANGUAGES], + // avoid reporting translation issues with default language - https://github.com/GertjanReynaert/react-intl-translations-manager/issues/76 + overrideCoreMethods: { + provideWhitelistFile: language => { + // Avoid reporting untranslated stuff in defaultLanguage + if (language.lang === DEFAULT_LANGUAGE) { + const messageFiles = readMessageFiles(TEMP_DIR); + const messages = getDefaultMessages(messageFiles).messages; + return Object.keys(messages); + } else { + if (!fs.existsSync(language.whitelistFilepath)) { + return []; + } + return JSON.parse( + fs.readFileSync(language.whitelistFilepath, "utf-8") + ); + } + } + } + }); + + rimraf.sync(TEMP_DIR); +}); diff --git a/src/translations/en.json b/src/translations/en.json new file mode 100644 index 000000000..0b62fa5a0 --- /dev/null +++ b/src/translations/en.json @@ -0,0 +1,36 @@ +{ + "toolbar-gpio.description": "8 GPIOs on CPX! Pin A1 - A7 can also be used as capacitive touch sensors, and A0 is a true analog output pin.", + "toolbar-gpio.title": "GPIO", + "toolbar-gpio.tryItDescriptrion": "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7”", + "toolbar-ir-sensor.description": "Allows you to send commands to the CPX with a remote control, or even send messages between multiple CPXs! You can also do very simple proximity sensing since it reads the reflected light.", + "toolbar-ir-sensor.title": "IR Transmit & Receiver", + "toolbar-ir-sensor.tryItDescriptrion": "", + "toolbar-ir-sensor.tryItTitle": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + "toolbar-light-sensor.description": "An analog light sensor can be used to detect ambient light, with similar spectral response to the human eye.", + "toolbar-light-sensor.title": "Light Sensor", + "toolbar-light-sensor.tryItDescriptrion": "Change the brightness from 0 - 255 here!", + "toolbar-motion-sensor.description": "Detects acceleration in XYZ orientations. And can also detect 'tap' and 'double tap' strikes on the board and when the board is shaken.", + "toolbar-motion-sensor.title": "Motion Sensor", + "toolbar-motion-sensor.tryItDescriptrion": "Change the acceleration here and click or click on the button to simulate a shake.The tap feature is not supported by pacifica. You can try it on MakeCode!", + "toolbar-neo-pixels.description": "The 10 full color RGB LEDs surrounding the outer edge of the boards can be set to any color. Great for beautiful lighting effects!", + "toolbar-neo-pixels.title": "NeoPixels", + "toolbar-neo-pixels.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", + "toolbar-push-button.description": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.", + "toolbar-push-button.title": "Push Buttons", + "toolbar-push-button.tryItDescriptrion": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.", + "toolbar-red-led.description": "This Red LED is connected to the digital #13 GPIO pin. It can be very handy when you want an indicator LED.", + "toolbar-red-led.title": "Red LED", + "toolbar-red-led.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", + "toolbar-sound-sensor.description": "A digital microphone can detect audio volume and even perform basic FFT functions but cannot read it like an analog voltage.", + "toolbar-sound-sensor.title": "Sound Sensor", + "toolbar-sound-sensor.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + "toolbar-slider-switch.description": "A digital microphone can detect audio volume and even perform basic FFT functions but cannot read it like an analog voltage.", + "toolbar-slider-switch.title": "Slider Switch", + "toolbar-slider-switch.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + "toolbar-speaker.description": "This speaker can play .wav file and different tones and also has a class D amplifier that is connected to an output A0 pin built in! You can turn it off using the shutdown control on pin #11 on the physical device.", + "toolbar-speaker.title": "Speaker", + "toolbar-speaker.tryItDescriptrion": "Run your code and you’ll hear the music!", + "toolbar-temperature-sensor.description": "", + "toolbar-temperature-sensor.title": "Temperature Sensor", + "toolbar-temperature-sensor.tryItDescriptrion": "You can set the temperature range from your code!" +} diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index 4008870ca..1baabebbf 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -175,6 +175,7 @@ class ToolBar extends React.Component { focusable={false} />
+ {this.getIconModal()}
diff --git a/src/view/components/toolbar/sensorModalUtils.tsx b/src/view/components/toolbar/sensorModalUtils.tsx index 91cae2717..601919022 100644 --- a/src/view/components/toolbar/sensorModalUtils.tsx +++ b/src/view/components/toolbar/sensorModalUtils.tsx @@ -78,7 +78,7 @@ export const GPIO_MODAL_CONTENT: IModalContent = { "8 GPIOs on CPX! Pin A1 - A7 can also be used as capacitive touch sensors, and A0 is a true analog output pin.", tryItTitle: "Simulation Coming Soon!", tryItDescriptrion: - "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7", component: TRY_IT_MAKE_CODE, id: "GPIO" }; @@ -114,7 +114,7 @@ export const MOTION_MODAL_CONTENT: IModalContent = { "Detects acceleration in XYZ orientations. And can also detect 'tap' and 'double tap' strikes on the board and when the board is shaken.", tryItTitle: "Try it on the Simulator!", tryItDescriptrion: - "Change the acceleration here and click on the sensor on the board to simulate the “tap”!", + "Change the acceleration here and click or click on the button to simulate a shake.The tap feature is not supported by pacifica. You can try it on MakeCode!", component: , id: "motion_sensor" }; @@ -165,7 +165,7 @@ export const SOUND_MODAL_CONTENT: IModalContent = { id: "sound_sensor" }; export const SWITCH_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Slide Switch ", + descriptionTitle: "Slider Switch", tagInput: TAG_INPUT_SVG, tagOutput: undefined, descriptionText: @@ -176,7 +176,7 @@ export const SWITCH_MODAL_CONTENT: IModalContent = { id: "slider_switch" }; export const SPEAKER_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Speaker ", + descriptionTitle: "Speaker", tagInput: undefined, tagOutput: TAG_OUTPUT_SVG, descriptionText: diff --git a/src/view/translation/en.json b/src/view/translation/en.json deleted file mode 100644 index 3d664bf38..000000000 --- a/src/view/translation/en.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "toolbar-gpio.title": "", - "toolbar-ir-sensor.title": "", - "left-edge.title": "", - "toolbar-light-sensor.title": "", - "toolbar-motion-sensor.title": "", - "toolbar-neo-pixels.title": "", - "toolbar-push-button.title": "", - "toolbar-red-led.title": "", - "right-edge.title": "", - "toolbar-sound-sensor.title": "", - "toolbar-speaker.title": "", - "toolbar-slider-switch.title": "", - "toolbar-temperature-sensor.title": "", - "toolbar-gpio.description": "", - "toolbar-ir-sensor.description": "", - "left-edge.description": "", - "toolbar-light-sensor.description": "", - "toolbar-motion-sensor.description": "", - "toolbar-neo-pixels.description": "", - "toolbar-push-button.description": "", - "toolbar-red-led.description": "", - "right-edge.description": "", - "toolbar-sound-sensor.description": "", - "toolbar-speaker.description": "", - "toolbar-slider-switch.description": "", - "toolbar-temperature-sensor.description": "", - "toolbar-gpio.tryItTitle": "", - "toolbar-ir-sensor.tryItTitle": "", - "left-edge.tryItTitle": "", - "toolbar-light-sensor.tryItTitle": "", - "toolbar-motion-sensor.tryItTitle": "", - "toolbar-neo-pixels.tryItTitle": "", - "toolbar-push-button.tryItTitle": "", - "toolbar-red-led.tryItTitle": "", - "right-edge.tryItTitle": "", - "toolbar-sound-sensor.tryItTitle": "", - "toolbar-speaker.tryItTitle": "", - "toolbar-slider-switch.tryItTitle": "", - "toolbar-temperature-sensor.tryItTitle": "", - "toolbar-gpio.tryItDescriptrion": "", - "toolbar-ir-sensor.tryItDescriptrion": "", - "left-edge.tryItDescriptrion": "", - "toolbar-light-sensor.tryItDescriptrion": "", - "toolbar-motion-sensor.tryItDescriptrion": "", - "toolbar-neo-pixels.tryItDescriptrion": "", - "toolbar-push-button.tryItDescriptrion": "", - "toolbar-red-led.tryItDescriptrion": "", - "right-edge.tryItDescriptrion": "", - "toolbar-sound-sensor.tryItDescriptrion": "", - "toolbar-speaker.tryItDescriptrion": "", - "toolbar-slider-switch.tryItDescriptrion": "", - "toolbar-temperature-sensor.tryItDescriptrion": "" -} From 473e2f53d515c1df5f611fe6d94a47c782ac74ce Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 17:30:45 -0700 Subject: [PATCH 07/18] revoving lines --- scripts/manageTranslations.js | 2 +- src/{ => view}/translations/en.json | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/{ => view}/translations/en.json (100%) diff --git a/scripts/manageTranslations.js b/scripts/manageTranslations.js index aae4ad17d..55640af64 100644 --- a/scripts/manageTranslations.js +++ b/scripts/manageTranslations.js @@ -6,7 +6,7 @@ const DEFAULT_LANGUAGE = "en"; // for the default language, everything is automatically whitelisted const LANGUAGES = []; // translations to generate---don't include the default language -const TARGET_DIRECTORY = "src/translations"; +const TARGET_DIRECTORY = "src/view/translations"; const EXTRACT_MESSAGE_FILE_PATTERN = "src/**/*.@(tsx|ts)"; const TEMP_DIR = "./temp"; diff --git a/src/translations/en.json b/src/view/translations/en.json similarity index 100% rename from src/translations/en.json rename to src/view/translations/en.json From d1ec19a01cece3b4e37455d62d689d4cce409ea4 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 17:58:00 -0700 Subject: [PATCH 08/18] adding meesage file --- src/view/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/view/index.tsx b/src/view/index.tsx index 4150ddac4..9584029f2 100644 --- a/src/view/index.tsx +++ b/src/view/index.tsx @@ -8,10 +8,11 @@ import { IntlProvider } from "react-intl"; import "./index.css"; +const messageEn = require("./translations/en.json"); const locale = "en"; ReactDOM.render( - + , document.getElementById("root") From 9517b567ee755d3b0e6c38883238d5f6b6155595 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 18:23:03 -0700 Subject: [PATCH 09/18] adjusting view --- src/view/components/toolbar/ToolBar.tsx | 13 +++++++++---- src/view/components/toolbar/sensorModalUtils.tsx | 2 +- src/view/index.tsx | 3 +-- src/view/styles/ToolBar.css | 9 ++++++++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index 38adcd0b7..9d3e2dafd 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -271,10 +271,15 @@ class ToolBar extends React.Component { />
- +
+ + + +
+
{component}
diff --git a/src/view/components/toolbar/sensorModalUtils.tsx b/src/view/components/toolbar/sensorModalUtils.tsx index 601919022..f08f405c3 100644 --- a/src/view/components/toolbar/sensorModalUtils.tsx +++ b/src/view/components/toolbar/sensorModalUtils.tsx @@ -79,7 +79,7 @@ export const GPIO_MODAL_CONTENT: IModalContent = { tryItTitle: "Simulation Coming Soon!", tryItDescriptrion: "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7", - component: TRY_IT_MAKE_CODE, + component: undefined, id: "GPIO" }; diff --git a/src/view/index.tsx b/src/view/index.tsx index 9584029f2..4150ddac4 100644 --- a/src/view/index.tsx +++ b/src/view/index.tsx @@ -8,11 +8,10 @@ import { IntlProvider } from "react-intl"; import "./index.css"; -const messageEn = require("./translations/en.json"); const locale = "en"; ReactDOM.render( - + , document.getElementById("root") diff --git a/src/view/styles/ToolBar.css b/src/view/styles/ToolBar.css index 0e15109a4..7c9d44209 100644 --- a/src/view/styles/ToolBar.css +++ b/src/view/styles/ToolBar.css @@ -76,6 +76,12 @@ .try_area { position: relative; padding-bottom: 30px; + text-align: left; + line-height: 17px; + font-weight: 100; + opacity: 50%; + font-size: 14px; + word-wrap: break-word; } .info { @@ -98,10 +104,11 @@ } .link-parent { + padding-top: 12px; -webkit-appearance: none; padding-left: 150px; color: var(--vscode-textLink-activeForeground); - text-align: left; + text-align: right; text-decoration: none; font-weight: bold; } From fc562389b9f744c2dd6f80a07be7cfcf0ccbb6d4 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Mon, 19 Aug 2019 18:26:08 -0700 Subject: [PATCH 10/18] remove manager --- package.json | 2 - scripts/manageTranslations.js | 77 ----------------------------------- 2 files changed, 79 deletions(-) delete mode 100644 scripts/manageTranslations.js diff --git a/package.json b/package.json index 7eb67be55..ddab02bc1 100644 --- a/package.json +++ b/package.json @@ -266,7 +266,6 @@ "lint": "tslint -c tslint.json src/**/*.{ts,tsx}", "format": "prettier --write src/**/*.{ts,tsx}", "tslint-check": "tslint-config-prettier-check ./tslint.json", - "manage:translations": "node scripts/manageTranslations.js", "package": "vsce package" }, "devDependencies": { @@ -289,7 +288,6 @@ "less-loader": "^4.1.0", "mocha": "^6.1.4", "npm-run-all": "^4.1.3", - "react-intl-translations-manager": "^5.0.3", "react-scripts": "3.0.1", "style-loader": "^0.21.0", "ts-import-plugin": "^1.5.4", diff --git a/scripts/manageTranslations.js b/scripts/manageTranslations.js deleted file mode 100644 index 55640af64..000000000 --- a/scripts/manageTranslations.js +++ /dev/null @@ -1,77 +0,0 @@ -// This script was taken from https://github.com/bang88/typescript-react-intl/issues/19, it is used to extract strings -// to be localized from typescript source to .json resource files - -// For default languages and languages use the VSCode language codes. -// A list of all locales supported by VSCode can be found here: https://code.visualstudio.com/docs/getstarted/locales - -const DEFAULT_LANGUAGE = "en"; // for the default language, everything is automatically whitelisted -const LANGUAGES = []; // translations to generate---don't include the default language -const TARGET_DIRECTORY = "src/view/translations"; -const EXTRACT_MESSAGE_FILE_PATTERN = "src/**/*.@(tsx|ts)"; - -const TEMP_DIR = "./temp"; -const TEMP_MESSAGE_FILENAME = "allMessages.json"; - -const fs = require("fs"); -const path = require("path"); -const glob = require("glob"); -const rimraf = require("rimraf"); -const parser = require("typescript-react-intl").default; -const manageTranslations = require("react-intl-translations-manager").default; -const { - readMessageFiles, - getDefaultMessages -} = require("react-intl-translations-manager"); - -function extractTranslations(pattern, cb) { - let results = []; - pattern = pattern || "src/**/*.@(tsx|ts)"; - glob(pattern, function(err, files) { - if (err) { - throw new Error(err); - } - files.forEach(function(f) { - const contents = fs.readFileSync(f).toString(); - const res = parser(contents); - results = results.concat(res); - }); - - cb && cb(results); - }); -} - -if (!fs.existsSync(TEMP_DIR)) { - fs.mkdirSync(TEMP_DIR); -} - -const tempMessageFilePath = path.join(TEMP_DIR, TEMP_MESSAGE_FILENAME); - -extractTranslations(EXTRACT_MESSAGE_FILE_PATTERN, function(messages) { - fs.writeFileSync(tempMessageFilePath, JSON.stringify(messages, null, 2)); - - manageTranslations({ - messagesDirectory: TEMP_DIR, - translationsDirectory: TARGET_DIRECTORY, - languages: [DEFAULT_LANGUAGE, ...LANGUAGES], - // avoid reporting translation issues with default language - https://github.com/GertjanReynaert/react-intl-translations-manager/issues/76 - overrideCoreMethods: { - provideWhitelistFile: language => { - // Avoid reporting untranslated stuff in defaultLanguage - if (language.lang === DEFAULT_LANGUAGE) { - const messageFiles = readMessageFiles(TEMP_DIR); - const messages = getDefaultMessages(messageFiles).messages; - return Object.keys(messages); - } else { - if (!fs.existsSync(language.whitelistFilepath)) { - return []; - } - return JSON.parse( - fs.readFileSync(language.whitelistFilepath, "utf-8") - ); - } - } - } - }); - - rimraf.sync(TEMP_DIR); -}); From a532a5395db3503d9352713f9bd8492241d0f9db Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Tue, 20 Aug 2019 13:39:11 -0700 Subject: [PATCH 11/18] removing unused lines and using en file --- package-lock.json | 43 ---------- src/view/components/toolbar/ToolBar.tsx | 17 +--- .../components/toolbar/sensorModalUtils.tsx | 82 ++++++++----------- src/view/index.tsx | 7 +- src/view/translations/en.json | 4 +- 5 files changed, 44 insertions(+), 109 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea3f3f06d..91c89c9b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17549,49 +17549,6 @@ "shallow-equal": "^1.1.0" } }, - "react-intl-translations-manager": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/react-intl-translations-manager/-/react-intl-translations-manager-5.0.3.tgz", - "integrity": "sha512-EfBeugnOGFcdUbQyY9TqBMbuauQ8wm73ZqFr0UqCljhbXl7YDHQcVzclWFRkVmlUffzxitLQFhAZEVVeRNQSwA==", - "dev": true, - "requires": { - "chalk": "^2.3.2", - "glob": "^7.1.2", - "json-stable-stringify": "^1.0.1", - "mkdirp": "^0.5.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, "react-is": { "version": "16.8.6", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz", diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index 9d3e2dafd..2f13ce926 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -186,8 +186,6 @@ class ToolBar extends React.Component { focusable={false} /> - - {this.getIconModal()} @@ -255,28 +253,19 @@ class ToolBar extends React.Component {
- + {content["tagInput"]} {content["tagOutput"]}

- +

- +
diff --git a/src/view/components/toolbar/sensorModalUtils.tsx b/src/view/components/toolbar/sensorModalUtils.tsx index f08f405c3..5fca1cfc4 100644 --- a/src/view/components/toolbar/sensorModalUtils.tsx +++ b/src/view/components/toolbar/sensorModalUtils.tsx @@ -71,130 +71,114 @@ export const DEFAULT_MODAL_CONTENT: IModalContent = { id: "none" }; export const GPIO_MODAL_CONTENT: IModalContent = { - descriptionTitle: "GPIO", + descriptionTitle: "toolbar-gpio.title", tagInput: TAG_INPUT_SVG, tagOutput: TAG_OUTPUT_SVG, - descriptionText: - "8 GPIOs on CPX! Pin A1 - A7 can also be used as capacitive touch sensors, and A0 is a true analog output pin.", + descriptionText: "toolbar-gpio.description", tryItTitle: "Simulation Coming Soon!", - tryItDescriptrion: - "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7", + tryItDescriptrion: "toolbar-gpio.tryItDescriptrion", component: undefined, id: "GPIO" }; export const IR_MODAL_CONTENT: IModalContent = { - descriptionTitle: "IR Transmit & Receiver", + descriptionTitle: "toolbar-ir-sensor.title", tagInput: TAG_INPUT_SVG, tagOutput: TAG_OUTPUT_SVG, - descriptionText: - "Allows you to send commands to the CPX with a remote control, or even send messages between multiple CPXs! You can also do very simple proximity sensing since it reads the reflected light.", + descriptionText: "toolbar-ir-sensor.description", tryItTitle: "Simulation Coming Soon!", - tryItDescriptrion: - "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + tryItDescriptrion: "toolbar-ir-sensor.tryItDescriptrion", component: TRY_IT_MAKE_CODE, id: "IR" }; export const LIGHT_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Light Sensor", + descriptionTitle: "toolbar-light-sensor.title", tagInput: TAG_INPUT_SVG, tagOutput: undefined, - descriptionText: - "An analog light sensor can be used to detect ambient light, with similar spectral response to the human eye.", + descriptionText: "toolbar-light-sensor.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "Change the brightness from 0 - 255 here!", + tryItDescriptrion: "toolbar-light-sensor.tryItDescriptrion", component: , id: "light_sensor" }; export const MOTION_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Motion Sensor", + descriptionTitle: "toolbar-motion-sensor.title", tagInput: TAG_INPUT_SVG, tagOutput: undefined, - descriptionText: - "Detects acceleration in XYZ orientations. And can also detect 'tap' and 'double tap' strikes on the board and when the board is shaken.", + descriptionText: "toolbar-motion-sensor.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: - "Change the acceleration here and click or click on the button to simulate a shake.The tap feature is not supported by pacifica. You can try it on MakeCode!", + tryItDescriptrion: "toolbar-motion-sensor.tryItDescriptrion", component: , id: "motion_sensor" }; export const NEOP_MODAL_CONTENT: IModalContent = { - descriptionTitle: "NeoPixels", + descriptionTitle: "toolbar-neo-pixels.title", tagInput: undefined, tagOutput: TAG_OUTPUT_SVG, - descriptionText: - "The 10 full color RGB LEDs surrounding the outer edge of the boards can be set to any color. Great for beautiful lighting effects!", + descriptionText: "toolbar-neo-pixels.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "Run your code and see the cool effects on the simulator!", + tryItDescriptrion: "toolbar-neo-pixels.tryItDescriptrion", component: TRY_IT_MAKE_CODE, id: "neon_pixel" }; export const PUSHB_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Push Buttons", + descriptionTitle: "toolbar-push-button.title", tagInput: TAG_INPUT_SVG, tagOutput: undefined, - descriptionText: - "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.", + descriptionText: "toolbar-push-button.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: - "Click them with your mouse or pressing “A” “B” on your keyboard!", + tryItDescriptrion: "toolbar-push-button.tryItDescriptrion", component: undefined, id: "push_btn" }; export const RED_LED_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Red LED", + descriptionTitle: "toolbar-push-button.title", tagInput: undefined, tagOutput: TAG_OUTPUT_SVG, - descriptionText: - "This Red LED is connected to the digital #13 GPIO pin. It can be very handy when you want an indicator LED.", + descriptionText: "toolbar-red-led.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "Run your code and see the cool effects on the simulator!", + tryItDescriptrion: "toolbar-red-led.tryItDescriptrion", component: undefined, id: "red_LED" }; export const SOUND_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Sound Sensor", + descriptionTitle: "toolbar-sound-sensor.title", tagInput: TAG_INPUT_SVG, tagOutput: undefined, - descriptionText: - "A digital microphone can detect audio volume and even perform basic FFT functions but cannot read it like an analog voltage.", + descriptionText: "toolbar-sound-sensor.description", tryItTitle: "Simulation Coming Soon!", - tryItDescriptrion: - "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + tryItDescriptrion: "toolbar-sound-sensor.tryItDescriptrion", component: TRY_IT_MAKE_CODE, id: "sound_sensor" }; export const SWITCH_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Slider Switch", + descriptionTitle: "toolbar-slider-switch.title", tagInput: TAG_INPUT_SVG, tagOutput: undefined, - descriptionText: - "This slide switch returns True or False depending on whether it's ON or OFF and can be used as a toggle switch in your code!", + descriptionText: "toolbar-slider-switch.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "Click it with your mouse to switch it ON and OFF!", + tryItDescriptrion: "toolbar-slider-switch.tryItDescriptrion", component: undefined, id: "slider_switch" }; export const SPEAKER_MODAL_CONTENT: IModalContent = { - descriptionTitle: "Speaker", + descriptionTitle: "toolbar-speaker.title", tagInput: undefined, tagOutput: TAG_OUTPUT_SVG, - descriptionText: - "This speaker can play .wav file and different tones and also has a class D amplifier that is connected to an output A0 pin built in! You can turn it off using the shutdown control on pin #11 on the physical device.", + descriptionText: "toolbar-speaker.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "Run your code and you’ll hear music!", + tryItDescriptrion: "toolbar-speaker.tryItDescriptrion", component: undefined, id: "speaker" }; export const TEMPERATURE_MODAL_CONTENT: IModalContent = { component: , - descriptionText: - "This sensor uses an NTC thermistor to sense temperature an calculate it with the analog voltage on analog pin #A9.", - descriptionTitle: "Temperature Sensor", + descriptionText: "toolbar-temperature-sensor.description", + descriptionTitle: "toolbar-temperature-sensor.title", id: "temperature", tagInput: TAG_INPUT_SVG, tagOutput: undefined, - tryItDescriptrion: "You can set the temperature range from your code!", + tryItDescriptrion: "toolbar-temperature-sensor.tryItDescriptrion", tryItTitle: "Try it on the Simulator!" }; diff --git a/src/view/index.tsx b/src/view/index.tsx index 4150ddac4..d5a969aa8 100644 --- a/src/view/index.tsx +++ b/src/view/index.tsx @@ -8,10 +8,15 @@ import { IntlProvider } from "react-intl"; import "./index.css"; +const messageEn = require("./translations/en.json"); const locale = "en"; +const message = { + en: messageEn +}; + ReactDOM.render( - + , document.getElementById("root") diff --git a/src/view/translations/en.json b/src/view/translations/en.json index 0b62fa5a0..6eaa520e5 100644 --- a/src/view/translations/en.json +++ b/src/view/translations/en.json @@ -4,7 +4,7 @@ "toolbar-gpio.tryItDescriptrion": "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7”", "toolbar-ir-sensor.description": "Allows you to send commands to the CPX with a remote control, or even send messages between multiple CPXs! You can also do very simple proximity sensing since it reads the reflected light.", "toolbar-ir-sensor.title": "IR Transmit & Receiver", - "toolbar-ir-sensor.tryItDescriptrion": "", + "toolbar-ir-sensor.tryItDescriptrion": "Allows you to send commands to the CPX with a remote control, or even send messages between multiple CPXs! You can also do very simple proximity sensing since it reads the reflected light.", "toolbar-ir-sensor.tryItTitle": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-light-sensor.description": "An analog light sensor can be used to detect ambient light, with similar spectral response to the human eye.", "toolbar-light-sensor.title": "Light Sensor", @@ -30,7 +30,7 @@ "toolbar-speaker.description": "This speaker can play .wav file and different tones and also has a class D amplifier that is connected to an output A0 pin built in! You can turn it off using the shutdown control on pin #11 on the physical device.", "toolbar-speaker.title": "Speaker", "toolbar-speaker.tryItDescriptrion": "Run your code and you’ll hear the music!", - "toolbar-temperature-sensor.description": "", + "toolbar-temperature-sensor.description": "You can set the temperature range from your code", "toolbar-temperature-sensor.title": "Temperature Sensor", "toolbar-temperature-sensor.tryItDescriptrion": "You can set the temperature range from your code!" } From 2a5f12e6be29b427d291bf60d39d4f7e34e06b3f Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Tue, 20 Aug 2019 13:56:44 -0700 Subject: [PATCH 12/18] correcting errors --- src/view/translations/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/translations/en.json b/src/view/translations/en.json index 6eaa520e5..b31e8c493 100644 --- a/src/view/translations/en.json +++ b/src/view/translations/en.json @@ -17,7 +17,7 @@ "toolbar-neo-pixels.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", "toolbar-push-button.description": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.", "toolbar-push-button.title": "Push Buttons", - "toolbar-push-button.tryItDescriptrion": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.", + "toolbar-push-button.tryItDescriptrion": "Click them with your mouse or pressing “A” “B” on your keyboard!", "toolbar-red-led.description": "This Red LED is connected to the digital #13 GPIO pin. It can be very handy when you want an indicator LED.", "toolbar-red-led.title": "Red LED", "toolbar-red-led.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", @@ -30,7 +30,7 @@ "toolbar-speaker.description": "This speaker can play .wav file and different tones and also has a class D amplifier that is connected to an output A0 pin built in! You can turn it off using the shutdown control on pin #11 on the physical device.", "toolbar-speaker.title": "Speaker", "toolbar-speaker.tryItDescriptrion": "Run your code and you’ll hear the music!", - "toolbar-temperature-sensor.description": "You can set the temperature range from your code", + "toolbar-temperature-sensor.description": "This sensor uses an NTC thermistor to sense temperature an calculate it with the analog voltage on analog pin #A9.", "toolbar-temperature-sensor.title": "Temperature Sensor", "toolbar-temperature-sensor.tryItDescriptrion": "You can set the temperature range from your code!" } From 12dc8cf2c0418c934e5ee76af7e9d29b265e0a58 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Tue, 20 Aug 2019 14:03:43 -0700 Subject: [PATCH 13/18] adding ir --- src/view/translations/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/translations/en.json b/src/view/translations/en.json index b31e8c493..54654cc8e 100644 --- a/src/view/translations/en.json +++ b/src/view/translations/en.json @@ -4,7 +4,7 @@ "toolbar-gpio.tryItDescriptrion": "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7”", "toolbar-ir-sensor.description": "Allows you to send commands to the CPX with a remote control, or even send messages between multiple CPXs! You can also do very simple proximity sensing since it reads the reflected light.", "toolbar-ir-sensor.title": "IR Transmit & Receiver", - "toolbar-ir-sensor.tryItDescriptrion": "Allows you to send commands to the CPX with a remote control, or even send messages between multiple CPXs! You can also do very simple proximity sensing since it reads the reflected light.", + "toolbar-ir-sensor.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-ir-sensor.tryItTitle": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-light-sensor.description": "An analog light sensor can be used to detect ambient light, with similar spectral response to the human eye.", "toolbar-light-sensor.title": "Light Sensor", @@ -17,7 +17,7 @@ "toolbar-neo-pixels.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", "toolbar-push-button.description": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.", "toolbar-push-button.title": "Push Buttons", - "toolbar-push-button.tryItDescriptrion": "Click them with your mouse or pressing “A” “B” on your keyboard!", + "toolbar-push-button.tryItDescriptrion": "Click them with your mouse or by pressing “A” “B” on your keyboard!", "toolbar-red-led.description": "This Red LED is connected to the digital #13 GPIO pin. It can be very handy when you want an indicator LED.", "toolbar-red-led.title": "Red LED", "toolbar-red-led.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", From d0fa74f005ef3f588f78e5db1f94bbfd881f59cb Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Tue, 20 Aug 2019 14:08:50 -0700 Subject: [PATCH 14/18] correctin slider --- src/view/components/toolbar/sensorModalUtils.tsx | 2 +- src/view/translations/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view/components/toolbar/sensorModalUtils.tsx b/src/view/components/toolbar/sensorModalUtils.tsx index 5fca1cfc4..c47e4a700 100644 --- a/src/view/components/toolbar/sensorModalUtils.tsx +++ b/src/view/components/toolbar/sensorModalUtils.tsx @@ -132,7 +132,7 @@ export const PUSHB_MODAL_CONTENT: IModalContent = { id: "push_btn" }; export const RED_LED_MODAL_CONTENT: IModalContent = { - descriptionTitle: "toolbar-push-button.title", + descriptionTitle: "toolbar-red-led.title", tagInput: undefined, tagOutput: TAG_OUTPUT_SVG, descriptionText: "toolbar-red-led.description", diff --git a/src/view/translations/en.json b/src/view/translations/en.json index 54654cc8e..23c198b44 100644 --- a/src/view/translations/en.json +++ b/src/view/translations/en.json @@ -24,7 +24,7 @@ "toolbar-sound-sensor.description": "A digital microphone can detect audio volume and even perform basic FFT functions but cannot read it like an analog voltage.", "toolbar-sound-sensor.title": "Sound Sensor", "toolbar-sound-sensor.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", - "toolbar-slider-switch.description": "A digital microphone can detect audio volume and even perform basic FFT functions but cannot read it like an analog voltage.", + "toolbar-slider-switch.description": "This slide switch returns True or False depending on whether it's ON or OFF and can be used as a toggle switch in your code!", "toolbar-slider-switch.title": "Slider Switch", "toolbar-slider-switch.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-speaker.description": "This speaker can play .wav file and different tones and also has a class D amplifier that is connected to an output A0 pin built in! You can turn it off using the shutdown control on pin #11 on the physical device.", From 44d3ed3417f5d65027317ccf2c03ef8afe9631b9 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Tue, 20 Aug 2019 14:12:11 -0700 Subject: [PATCH 15/18] coorect slider --- src/view/translations/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/translations/en.json b/src/view/translations/en.json index 23c198b44..15483afa9 100644 --- a/src/view/translations/en.json +++ b/src/view/translations/en.json @@ -26,7 +26,7 @@ "toolbar-sound-sensor.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-slider-switch.description": "This slide switch returns True or False depending on whether it's ON or OFF and can be used as a toggle switch in your code!", "toolbar-slider-switch.title": "Slider Switch", - "toolbar-slider-switch.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + "toolbar-slider-switch.tryItDescriptrion": "Click it with your mouse to switch it ON and OFF!", "toolbar-speaker.description": "This speaker can play .wav file and different tones and also has a class D amplifier that is connected to an output A0 pin built in! You can turn it off using the shutdown control on pin #11 on the physical device.", "toolbar-speaker.title": "Speaker", "toolbar-speaker.tryItDescriptrion": "Run your code and you’ll hear the music!", From fbdfaa0c103bb7a169135fb5637aea2f05baa504 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Tue, 20 Aug 2019 14:14:15 -0700 Subject: [PATCH 16/18] solved major typo --- src/view/components/toolbar/ToolBar.tsx | 2 +- .../components/toolbar/sensorModalUtils.tsx | 26 +++++++++---------- src/view/translations/en.json | 22 ++++++++-------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index 2f13ce926..59bbd5f7d 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -265,7 +265,7 @@ class ToolBar extends React.Component {

- +
diff --git a/src/view/components/toolbar/sensorModalUtils.tsx b/src/view/components/toolbar/sensorModalUtils.tsx index c47e4a700..716bc5b1f 100644 --- a/src/view/components/toolbar/sensorModalUtils.tsx +++ b/src/view/components/toolbar/sensorModalUtils.tsx @@ -56,7 +56,7 @@ export interface IModalContent { id: string; tagInput: any; tagOutput: any; - tryItDescriptrion: string; + tryItDescription: string; tryItTitle: string; } @@ -66,7 +66,7 @@ export const DEFAULT_MODAL_CONTENT: IModalContent = { tagOutput: undefined, descriptionText: "none", tryItTitle: "none", - tryItDescriptrion: "none", + tryItDescription: "none", component: undefined, id: "none" }; @@ -76,7 +76,7 @@ export const GPIO_MODAL_CONTENT: IModalContent = { tagOutput: TAG_OUTPUT_SVG, descriptionText: "toolbar-gpio.description", tryItTitle: "Simulation Coming Soon!", - tryItDescriptrion: "toolbar-gpio.tryItDescriptrion", + tryItDescription: "toolbar-gpio.tryItDescription", component: undefined, id: "GPIO" }; @@ -87,7 +87,7 @@ export const IR_MODAL_CONTENT: IModalContent = { tagOutput: TAG_OUTPUT_SVG, descriptionText: "toolbar-ir-sensor.description", tryItTitle: "Simulation Coming Soon!", - tryItDescriptrion: "toolbar-ir-sensor.tryItDescriptrion", + tryItDescription: "toolbar-ir-sensor.tryItDescription", component: TRY_IT_MAKE_CODE, id: "IR" }; @@ -97,7 +97,7 @@ export const LIGHT_MODAL_CONTENT: IModalContent = { tagOutput: undefined, descriptionText: "toolbar-light-sensor.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "toolbar-light-sensor.tryItDescriptrion", + tryItDescription: "toolbar-light-sensor.tryItDescription", component: , id: "light_sensor" }; @@ -107,7 +107,7 @@ export const MOTION_MODAL_CONTENT: IModalContent = { tagOutput: undefined, descriptionText: "toolbar-motion-sensor.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "toolbar-motion-sensor.tryItDescriptrion", + tryItDescription: "toolbar-motion-sensor.tryItDescription", component: , id: "motion_sensor" }; @@ -117,7 +117,7 @@ export const NEOP_MODAL_CONTENT: IModalContent = { tagOutput: TAG_OUTPUT_SVG, descriptionText: "toolbar-neo-pixels.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "toolbar-neo-pixels.tryItDescriptrion", + tryItDescription: "toolbar-neo-pixels.tryItDescription", component: TRY_IT_MAKE_CODE, id: "neon_pixel" }; @@ -127,7 +127,7 @@ export const PUSHB_MODAL_CONTENT: IModalContent = { tagOutput: undefined, descriptionText: "toolbar-push-button.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "toolbar-push-button.tryItDescriptrion", + tryItDescription: "toolbar-push-button.tryItDescription", component: undefined, id: "push_btn" }; @@ -137,7 +137,7 @@ export const RED_LED_MODAL_CONTENT: IModalContent = { tagOutput: TAG_OUTPUT_SVG, descriptionText: "toolbar-red-led.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "toolbar-red-led.tryItDescriptrion", + tryItDescription: "toolbar-red-led.tryItDescription", component: undefined, id: "red_LED" }; @@ -147,7 +147,7 @@ export const SOUND_MODAL_CONTENT: IModalContent = { tagOutput: undefined, descriptionText: "toolbar-sound-sensor.description", tryItTitle: "Simulation Coming Soon!", - tryItDescriptrion: "toolbar-sound-sensor.tryItDescriptrion", + tryItDescription: "toolbar-sound-sensor.tryItDescription", component: TRY_IT_MAKE_CODE, id: "sound_sensor" }; @@ -157,7 +157,7 @@ export const SWITCH_MODAL_CONTENT: IModalContent = { tagOutput: undefined, descriptionText: "toolbar-slider-switch.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "toolbar-slider-switch.tryItDescriptrion", + tryItDescription: "toolbar-slider-switch.tryItDescription", component: undefined, id: "slider_switch" }; @@ -167,7 +167,7 @@ export const SPEAKER_MODAL_CONTENT: IModalContent = { tagOutput: TAG_OUTPUT_SVG, descriptionText: "toolbar-speaker.description", tryItTitle: "Try it on the Simulator!", - tryItDescriptrion: "toolbar-speaker.tryItDescriptrion", + tryItDescription: "toolbar-speaker.tryItDescription", component: undefined, id: "speaker" }; @@ -178,7 +178,7 @@ export const TEMPERATURE_MODAL_CONTENT: IModalContent = { id: "temperature", tagInput: TAG_INPUT_SVG, tagOutput: undefined, - tryItDescriptrion: "toolbar-temperature-sensor.tryItDescriptrion", + tryItDescription: "toolbar-temperature-sensor.tryItDescription", tryItTitle: "Try it on the Simulator!" }; diff --git a/src/view/translations/en.json b/src/view/translations/en.json index 15483afa9..5bc2bbc40 100644 --- a/src/view/translations/en.json +++ b/src/view/translations/en.json @@ -1,36 +1,36 @@ { "toolbar-gpio.description": "8 GPIOs on CPX! Pin A1 - A7 can also be used as capacitive touch sensors, and A0 is a true analog output pin.", "toolbar-gpio.title": "GPIO", - "toolbar-gpio.tryItDescriptrion": "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7”", + "toolbar-gpio.tryItDescription": "Use your mouse to interact with the pin A1 - A7 or use your keyboard SHIFT+”1” - “7”", "toolbar-ir-sensor.description": "Allows you to send commands to the CPX with a remote control, or even send messages between multiple CPXs! You can also do very simple proximity sensing since it reads the reflected light.", "toolbar-ir-sensor.title": "IR Transmit & Receiver", - "toolbar-ir-sensor.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + "toolbar-ir-sensor.tryItDescription": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-ir-sensor.tryItTitle": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-light-sensor.description": "An analog light sensor can be used to detect ambient light, with similar spectral response to the human eye.", "toolbar-light-sensor.title": "Light Sensor", - "toolbar-light-sensor.tryItDescriptrion": "Change the brightness from 0 - 255 here!", + "toolbar-light-sensor.tryItDescription": "Change the brightness from 0 - 255 here!", "toolbar-motion-sensor.description": "Detects acceleration in XYZ orientations. And can also detect 'tap' and 'double tap' strikes on the board and when the board is shaken.", "toolbar-motion-sensor.title": "Motion Sensor", - "toolbar-motion-sensor.tryItDescriptrion": "Change the acceleration here and click or click on the button to simulate a shake.The tap feature is not supported by pacifica. You can try it on MakeCode!", + "toolbar-motion-sensor.tryItDescription": "Change the acceleration here and click or click on the button to simulate a shake.The tap feature is not supported by pacifica. You can try it on MakeCode!", "toolbar-neo-pixels.description": "The 10 full color RGB LEDs surrounding the outer edge of the boards can be set to any color. Great for beautiful lighting effects!", "toolbar-neo-pixels.title": "NeoPixels", - "toolbar-neo-pixels.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", + "toolbar-neo-pixels.tryItDescription": "Run your code and see the cool effects on the simulator!", "toolbar-push-button.description": "Two push buttons A and B are connected to digital pin #4 (Left) and #5 (Right) each.", "toolbar-push-button.title": "Push Buttons", - "toolbar-push-button.tryItDescriptrion": "Click them with your mouse or by pressing “A” “B” on your keyboard!", + "toolbar-push-button.tryItDescription": "Click them with your mouse or by pressing “A” “B” on your keyboard!", "toolbar-red-led.description": "This Red LED is connected to the digital #13 GPIO pin. It can be very handy when you want an indicator LED.", "toolbar-red-led.title": "Red LED", - "toolbar-red-led.tryItDescriptrion": "Run your code and see the cool effects on the simulator!", + "toolbar-red-led.tryItDescription": "Run your code and see the cool effects on the simulator!", "toolbar-sound-sensor.description": "A digital microphone can detect audio volume and even perform basic FFT functions but cannot read it like an analog voltage.", "toolbar-sound-sensor.title": "Sound Sensor", - "toolbar-sound-sensor.tryItDescriptrion": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", + "toolbar-sound-sensor.tryItDescription": "We’re working hard to support this sensor on the simulator in the Pacifica. You can try it on MakeCode!", "toolbar-slider-switch.description": "This slide switch returns True or False depending on whether it's ON or OFF and can be used as a toggle switch in your code!", "toolbar-slider-switch.title": "Slider Switch", - "toolbar-slider-switch.tryItDescriptrion": "Click it with your mouse to switch it ON and OFF!", + "toolbar-slider-switch.tryItDescription": "Click it with your mouse to switch it ON and OFF!", "toolbar-speaker.description": "This speaker can play .wav file and different tones and also has a class D amplifier that is connected to an output A0 pin built in! You can turn it off using the shutdown control on pin #11 on the physical device.", "toolbar-speaker.title": "Speaker", - "toolbar-speaker.tryItDescriptrion": "Run your code and you’ll hear the music!", + "toolbar-speaker.tryItDescription": "Run your code and you’ll hear the music!", "toolbar-temperature-sensor.description": "This sensor uses an NTC thermistor to sense temperature an calculate it with the analog voltage on analog pin #A9.", "toolbar-temperature-sensor.title": "Temperature Sensor", - "toolbar-temperature-sensor.tryItDescriptrion": "You can set the temperature range from your code!" + "toolbar-temperature-sensor.tryItDescription": "You can set the temperature range from your code!" } From 499b232624ad54c49f80f566ca432d350c91c750 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Wed, 21 Aug 2019 13:50:55 -0700 Subject: [PATCH 17/18] adding .po file --- .../locale/en/LC_MESSAGES/express.po | 26 +++++++++++++++++++ .../locale/express.pot | 26 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/adafruit_circuitplayground/locale/en/LC_MESSAGES/express.po create mode 100644 src/adafruit_circuitplayground/locale/express.pot diff --git a/src/adafruit_circuitplayground/locale/en/LC_MESSAGES/express.po b/src/adafruit_circuitplayground/locale/en/LC_MESSAGES/express.po new file mode 100644 index 000000000..50579af3a --- /dev/null +++ b/src/adafruit_circuitplayground/locale/en/LC_MESSAGES/express.po @@ -0,0 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-08-21 13:35-0700\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: express.py:190 +msgid " is not a path to a .wav file." +msgstr "" + +#: express.py:192 +msgid "Please use Python 3 or higher." +msgstr "" diff --git a/src/adafruit_circuitplayground/locale/express.pot b/src/adafruit_circuitplayground/locale/express.pot new file mode 100644 index 000000000..50579af3a --- /dev/null +++ b/src/adafruit_circuitplayground/locale/express.pot @@ -0,0 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-08-21 13:35-0700\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: express.py:190 +msgid " is not a path to a .wav file." +msgstr "" + +#: express.py:192 +msgid "Please use Python 3 or higher." +msgstr "" From c63a5b0a35d2ca04a46ab4cbe31fee7698ca4a84 Mon Sep 17 00:00:00 2001 From: Fatou Mounzeo Date: Wed, 21 Aug 2019 14:15:44 -0700 Subject: [PATCH 18/18] changing bounds --- src/view/components/toolbar/MotionSensorBar.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/view/components/toolbar/MotionSensorBar.tsx b/src/view/components/toolbar/MotionSensorBar.tsx index 12a84fac4..3dcdba145 100644 --- a/src/view/components/toolbar/MotionSensorBar.tsx +++ b/src/view/components/toolbar/MotionSensorBar.tsx @@ -28,22 +28,22 @@ const sendMessage = (state: any) => { const MOTION_SLIDER_PROPS_X: ISliderProps = { axisLabel: "X", maxLabel: "Right", - maxValue: 125, + maxValue: 78, minLabel: "Left", - minValue: -55, + minValue: -78, type: "motion_x" }; const MOTION_SLIDER_PROPS_Y: ISliderProps = { axisLabel: "Y", maxLabel: "Front", - maxValue: 125, + maxValue: 78, minLabel: "Back", - minValue: -55, + minValue: -78, type: "motion_y" }; const MOTION_SLIDER_PROPS_Z: ISliderProps = { - maxValue: 125, - minValue: -55, + maxValue: 78, + minValue: -78, minLabel: "Up", maxLabel: "Down", type: "motion_z",