From 670f897a80e7587afb14e6b30f368236960e06be Mon Sep 17 00:00:00 2001 From: David Ralph Date: Tue, 6 Apr 2021 22:34:47 +0100 Subject: [PATCH] fix: more translation support for settings and feedback --- package.json | 14 ++++++------- src/components/modals/ErrorBoundary.jsx | 7 ++++--- src/components/modals/feedback/Feedback.jsx | 21 +++++++++---------- .../modals/main/settings/Dropdown.jsx | 4 ++-- .../modals/main/settings/FileUpload.jsx | 2 +- .../modals/main/settings/sections/Time.jsx | 6 +++--- src/modules/constants.js | 2 +- src/translations/en_GB.json | 10 +++++++++ 8 files changed, 38 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 8a116153..3a0974a1 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,13 @@ "@material-ui/icons": "4.11.2", "array-move": "^3.0.1", "react": "17.0.2", - "react-clock": "^3.0.0", - "react-color-gradient-picker": "^0.1.2", - "react-day-picker": "^7.4.10", - "react-device-detect": "^1.17.0", + "react-clock": "3.0.0", + "react-color-gradient-picker": "0.1.2", + "react-day-picker": "7.4.10", + "react-device-detect": "1.17.0", "react-dom": "17.0.2", "react-modal": "3.12.1", - "react-sortable-hoc": "^2.0.0", + "react-sortable-hoc": "2.0.0", "react-toastify": "7.0.3" }, "devDependencies": { @@ -34,14 +34,14 @@ "@babel/preset-env": "^7.13.12", "@babel/preset-react": "^7.13.13", "babel-loader": "^8.2.2", - "copy-webpack-plugin": "^8.1.0", + "copy-webpack-plugin": "^8.1.1", "css-loader": "^5.2.0", "html-webpack-plugin": "^5.3.1", "mini-css-extract-plugin": "^1.4.0", "sass": "^1.32.8", "sass-loader": "^11.0.1", "source-map-loader": "^2.0.1", - "webpack": "^5.28.0", + "webpack": "^5.30.0", "webpack-cli": "^4.6.0", "webpack-dev-server": "^3.11.2" }, diff --git a/src/components/modals/ErrorBoundary.jsx b/src/components/modals/ErrorBoundary.jsx index f64d3566..0c5b9622 100644 --- a/src/components/modals/ErrorBoundary.jsx +++ b/src/components/modals/ErrorBoundary.jsx @@ -6,6 +6,7 @@ export default class ErrorBoundary extends React.PureComponent { this.state = { error: false }; + this.language = window.language.modals.main.error_boundary; } static getDerivedStateFromError(error) { @@ -19,9 +20,9 @@ export default class ErrorBoundary extends React.PureComponent { if (this.state.error) { return (
-

Error

-

Failed to load this component of Mue.

- +

{this.language.title}

+

{this.language.message}

+
); } diff --git a/src/components/modals/feedback/Feedback.jsx b/src/components/modals/feedback/Feedback.jsx index fbbe3b9d..73b56590 100644 --- a/src/components/modals/feedback/Feedback.jsx +++ b/src/components/modals/feedback/Feedback.jsx @@ -12,17 +12,18 @@ export default class FeedbackModal extends React.PureComponent { questionfourerror: '', formsubmit: '' }; + this.language = window.language.modals.feedback; } async submitForm () { let questiontwoerror, questionfourerror; if (document.getElementById('questiontwo').value.length <= 0) { - questiontwoerror = 'Question box must be filled'; + questiontwoerror = this.language.not_filled; } if (document.getElementById('questionfour').value.length <= 0) { - questionfourerror = 'Question box must be filled'; + questionfourerror = this.language.not_filled; } if (questiontwoerror || questionfourerror) { @@ -41,7 +42,7 @@ export default class FeedbackModal extends React.PureComponent { }); this.setState({ - formsubmit: 'Sent successfully!' + formsubmit: this.language.success }); setTimeout(() => { @@ -51,16 +52,14 @@ export default class FeedbackModal extends React.PureComponent { } render() { - const { feedback } = window.language.modals; - return (
-

{feedback.title}

+

{this.language.title}

× <> <> - +

this.setState({ questionone: e.target.value })}/> @@ -68,12 +67,12 @@ export default class FeedbackModal extends React.PureComponent {

<> - +