From 109918a2c6ae31f3443fd299b1fb7c651b9cd9eb Mon Sep 17 00:00:00 2001 From: David Ralph Date: Fri, 3 Jun 2022 21:18:47 +0100 Subject: [PATCH] feat(translations): first half of 7.0 translation support --- package.json | 14 ++++----- src/components/modals/ErrorBoundary.jsx | 14 +++++++-- .../modals/main/settings/FileUpload.jsx | 4 +-- .../modals/main/settings/Header.jsx | 8 ++--- .../modals/main/settings/ResetModal.jsx | 17 +++++++++-- .../modals/main/tabs/backend/Tabs.jsx | 22 ++++++++++++-- .../widgets/background/PhotoInformation.jsx | 11 ++++--- src/components/widgets/navbar/Todo.jsx | 6 ++-- src/components/widgets/quote/Quote.jsx | 16 +++++----- src/components/widgets/weather/Weather.jsx | 6 ++-- src/modules/constants.js | 2 +- src/translations/en_GB.json | 29 +++++++++++++++++-- 12 files changed, 108 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 2cc15625..aeea7b65 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@floating-ui/react-dom": "^0.7.0", "@fontsource/lexend-deca": "4.4.5", "@fontsource/montserrat": "4.4.5", - "@mui/material": "5.7.0", + "@mui/material": "5.8.2", "@sentry/react": "^6.19.7", "image-conversion": "^2.1.1", "react": "^18.1.0", @@ -25,21 +25,21 @@ "react-color-gradient-picker": "0.1.2", "react-dom": "^18.1.0", "react-hot-keys": "2.7.2", - "react-icons": "^4.3.1", + "react-icons": "^4.4.0", "react-modal": "3.15.1", "react-sortable-hoc": "2.0.0", - "react-toastify": "9.0.0" + "react-toastify": "9.0.3" }, "devDependencies": { "@eartharoid/deep-merge": "^0.0.2", "@vitejs/plugin-react": "^1.3.2", - "eslint": "^8.15.0", + "eslint": "^8.16.0", "eslint-config-react-app": "^7.0.1", "prettier": "^2.6.2", - "sass": "^1.51.0", - "stylelint": "^14.8.2", + "sass": "^1.52.2", + "stylelint": "^14.8.5", "stylelint-config-prettier-scss": "^0.0.1", - "stylelint-config-standard-scss": "^3.0.0", + "stylelint-config-standard-scss": "^4.0.0", "vite": "^2.9.9" }, "scripts": { diff --git a/src/components/modals/ErrorBoundary.jsx b/src/components/modals/ErrorBoundary.jsx index b1714a17..648a4caf 100644 --- a/src/components/modals/ErrorBoundary.jsx +++ b/src/components/modals/ErrorBoundary.jsx @@ -49,9 +49,19 @@ export default class ErrorBoundary extends PureComponent {
{this.state.showReport ? ( - + ) : ( - Sent! + + {variables.language.getMessage( + variables.languagecode, + 'modals.main.error_boundary.sent', + )} + )}
{this.props.switch ? ( - +
@@ -40,11 +45,17 @@ export default function ResetModal({ modalClose }) {
diff --git a/src/components/modals/main/tabs/backend/Tabs.jsx b/src/components/modals/main/tabs/backend/Tabs.jsx index 94348b95..58629cc2 100644 --- a/src/components/modals/main/tabs/backend/Tabs.jsx +++ b/src/components/modals/main/tabs/backend/Tabs.jsx @@ -89,21 +89,37 @@ export default class Tabs extends PureComponent { onClick={() => this.props.changeTab('settings')} > - Settings + + {' '} + {variables.language.getMessage( + variables.languagecode, + 'modals.main.navbar.settings', + )} + {this.props.children.map((tab) => { diff --git a/src/components/widgets/background/PhotoInformation.jsx b/src/components/widgets/background/PhotoInformation.jsx index 66bbb945..2479a32f 100644 --- a/src/components/widgets/background/PhotoInformation.jsx +++ b/src/components/widgets/background/PhotoInformation.jsx @@ -35,13 +35,16 @@ const downloadImage = async (info) => { variables.stats.postEvent('feature', 'Background download'); }; + +const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); + export default function PhotoInformation({ info, url, api }) { const [width, setWidth] = useState(0); const [height, setHeight] = useState(0); const [usePhotoMap, setPhotoMap] = useState(false); const [setMapIcon] = useState(true); const [showExtraInfo, setshowExtraInfo] = useState(false); - const [showOld, setShowOld] = useState(true); + //const [showOld, setShowOld] = useState(true); const [other, setOther] = useState(false); const [shareModal, openShareModal] = useState(false); @@ -268,13 +271,13 @@ export default function PhotoInformation({ info, url, api }) { {showExtraInfo || other ? ( <>
- + openShareModal(true)} /> - + - + downloadImage(info)} />
diff --git a/src/components/widgets/navbar/Todo.jsx b/src/components/widgets/navbar/Todo.jsx index d43ce009..78961f8f 100644 --- a/src/components/widgets/navbar/Todo.jsx +++ b/src/components/widgets/navbar/Todo.jsx @@ -144,15 +144,15 @@ class Todo extends PureComponent {
- Todo + {variables.language.getMessage(variables.languagecode, 'widgets.navbar.todo.title')}
- + - + diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index 2e5bfb2f..a68f7ceb 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -22,33 +22,34 @@ import Interval from 'modules/helpers/interval'; import EventBus from 'modules/helpers/eventbus'; import './quote.scss'; -import { getInitColorSchemeScript } from '@mui/material'; + +const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); export default class Quote extends PureComponent { buttons = { share: ( - + ), copy: ( - + ), unfavourited: ( - + ), favourited: ( - + @@ -298,7 +299,7 @@ export default class Quote extends PureComponent { copyQuote() { variables.stats.postEvent('feature', 'Quote copied'); navigator.clipboard.writeText(`${this.state.quote} - ${this.state.author}`); - toast(variables.language.getMessage(variables.languagecode, 'toasts.quote')); + toast(getMessage('toasts.quote')); } tweetQuote() { @@ -461,13 +462,14 @@ export default class Quote extends PureComponent {
) : (
+ {/* these are placeholders for skeleton and as such don't need translating */} loading loading
)}
{this.state.authorOccupation !== 'Unknown' && this.state.authorlink !== '' ? ( - + = 3 && ( - Extra Information + {variables.language.getMessage(variables.languagecode, 'widgets.weather.extra_information')} )} {enabled('cloudiness') ? ( @@ -279,7 +279,9 @@ export default class Weather extends PureComponent { {localStorage.getItem('weatherType') >= 2 && (
{/*{enabled('humidity') ? {this.state.weather.humidity}% : null}*/} - Feels like {this.state.weather.temp_feels_like + this.state.temp_text} + {variables.language.getMessage(variables.languagecode, 'widgets.weather.feels_like', { + amount: this.state.weather.temp_feels_like + this.state.temp_text + })} {this.state.location}
)} diff --git a/src/modules/constants.js b/src/modules/constants.js index fae62c40..955ce2eb 100644 --- a/src/modules/constants.js +++ b/src/modules/constants.js @@ -11,7 +11,7 @@ export const OPENSTREETMAP_URL = 'https://www.openstreetmap.org'; // Mue URLs export const WEBSITE_URL = 'https://muetab.com'; export const PRIVACY_URL = 'https://muetab.com/privacy'; -export const BLOG_POST = 'https://blog.muetab.com/posts/version-6-0'; +export const BLOG_POST = 'https://blog.muetab.com/posts/version-7-0'; export const TRANSLATIONS_URL = 'https://docs.muetab.com/translations/'; export const REPORT_ITEM = 'https://github.com/mue/marketplace/issues/new?assignees=&labels=item+report&template=item-report.md&title=%5BItem+Report%5D+'; diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index 1f4b1e3d..c5c41c2f 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -32,7 +32,16 @@ }, "weather": { "not_found": "Not Found", - "meters": "{amount} metres" + "meters": "{amount} metres", + "extra_information": "Extra Information", + "feels_like": "Feels like {amount}" + }, + "quote": { + "link_tooltip": "Open on Wikipedia", + "share": "Share", + "copy": "Copy", + "favourite": "Favourite", + "unfavourite": "Unfavourite" }, "navbar": { "tooltips": { @@ -41,6 +50,11 @@ "notes": { "title": "Notes", "placeholder": "Type here" + }, + "todo": { + "title": "Todo", + "pin": "Pin", + "add": "Add" } } }, @@ -51,12 +65,14 @@ "file_upload_error": "File is over 2MB", "navbar": { "settings": "Settings", - "addons": "My Add-ons", + "addons": "Add-ons", "marketplace": "Marketplace" }, "error_boundary": { "title": "Error", "message": "Failed to load this component of Mue", + "report_error": "Send Error Report", + "sent": "Sent!", "refresh": "Refresh" }, "settings": { @@ -66,6 +82,12 @@ "message": "In order for all of the changes to take place, the page must be refreshed." }, "sections": { + "header": { + "more_info": "More info", + "report_issue": "Report Issue", + "enabled": "Choose whether or not to show this widget", + "size": "Slider to control how large the widget is" + }, "time": { "title": "Time", "format": "Format", @@ -550,6 +572,7 @@ "uninstalled": "Successfully removed", "updated": "Successfully updated", "error": "Something went wrong", - "imported": "Successfully imported" + "imported": "Successfully imported", + "no_storage": "Not enough storage" } }