From 51eaf3a90eb3a1c454d01a2dc57d07521d62159e Mon Sep 17 00:00:00 2001 From: David Ralph Date: Thu, 18 Mar 2021 15:22:41 +0000 Subject: [PATCH] fix: translation cleanup --- .../modals/settings/sections/Advanced.jsx | 26 +++++----- .../modals/settings/sections/Background.jsx | 34 ++++++------ .../modals/settings/sections/Greeting.jsx | 20 +++---- .../modals/settings/sections/Language.jsx | 12 ++--- .../modals/settings/sections/Quote.jsx | 16 +++--- .../modals/settings/sections/Search.jsx | 14 ++--- .../modals/settings/sections/Time.jsx | 52 ++++++++++--------- src/components/modals/tabs/Settings.jsx | 20 +++---- .../widgets/background/Background.jsx | 2 +- src/components/widgets/quote/Quote.jsx | 4 +- src/scss/modules/_settings.scss | 13 ----- src/translations/en-GB.json | 22 ++++++-- src/translations/en-US.json | 3 ++ 13 files changed, 127 insertions(+), 111 deletions(-) diff --git a/src/components/modals/settings/sections/Advanced.jsx b/src/components/modals/settings/sections/Advanced.jsx index 313bba7b..7c263675 100644 --- a/src/components/modals/settings/sections/Advanced.jsx +++ b/src/components/modals/settings/sections/Advanced.jsx @@ -34,27 +34,29 @@ export default class AdvancedSettings extends React.PureComponent { } render() { + const { advanced } = this.props.language.sections; + return (
-

Advanced

- -

Data

- - - +

{advanced.title}

+ +

{advanced.data}

+ + + this.settingsImport(e)} /> -

Customisation

+

{advanced.customisation}

    -

    Custom CSS this.resetItem('customcss')}>Reset

    +

    {advanced.custom_css} this.resetItem('customcss')}>{this.props.language.buttons.reset}

    -

    Custom JS this.resetItem('customjs')}>Reset

    +

    {advanced.custom_js} this.resetItem('customjs')}>{this.props.language.buttons.reset}

-

Experimental

-

Please note that the Mue team cannot provide support if you have experimental mode on. Please disable it first and see if the issues continue to occur before contacting support.

- +

{this.props.language.sections.experimental.title}

+

{advanced.experimental_warning}

+
); } diff --git a/src/components/modals/settings/sections/Background.jsx b/src/components/modals/settings/sections/Background.jsx index bd44c961..b94aab80 100644 --- a/src/components/modals/settings/sections/Background.jsx +++ b/src/components/modals/settings/sections/Background.jsx @@ -14,7 +14,7 @@ import 'react-color-gradient-picker/dist/index.css'; import '../../../../scss/react-color-picker-gradient-picker-custom-styles.scss'; export default class BackgroundSettings extends React.PureComponent { - DefaultGradientSettings = { 'angle': '180', 'gradient': [{ 'colour': this.props.language.disabled, 'stop': 0 }], 'type': 'linear' }; + DefaultGradientSettings = { 'angle': '180', 'gradient': [{ 'colour': this.props.language.sections.background.disabled, 'stop': 0 }], 'type': 'linear' }; GradientPickerInitalState = undefined; constructor(...args) { @@ -131,14 +131,14 @@ export default class BackgroundSettings extends React.PureComponent { } currentGradientSettings = () => { - if (typeof this.state.gradientSettings === 'object' && this.state.gradientSettings.gradient.every(g => g.colour !== this.props.language.disabled)) { + if (typeof this.state.gradientSettings === 'object' && this.state.gradientSettings.gradient.every(g => g.colour !== this.props.language.sections.background.disabled)) { const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b)); return JSON.stringify({ ...this.state.gradientSettings, gradient: [...this.state.gradientSettings.gradient.map(g => { return { ...g, stop: clampNumber(+g.stop, 0, 100) } })].sort((a, b) => (a.stop > b.stop) ? 1 : -1) }); } - return this.props.language.disabled; + return this.props.language.sections.background.disabled; } onColorPickerChange = (attrs, name) => { @@ -171,12 +171,14 @@ export default class BackgroundSettings extends React.PureComponent { localStorage.setItem('brightness', this.state.brightness); localStorage.setItem('customBackground', this.state.customBackground); - if (document.getElementById('customBackgroundHex').value !== this.props.backgroundDisabled) { + if (document.getElementById('customBackgroundHex').value !== this.props.language.sections.background.disabled) { localStorage.setItem('customBackgroundColour', document.getElementById('customBackgroundHex').value); } } render() { + const { background } = this.props.language.sections; + let colourSettings = null; if (typeof this.state.gradientSettings === 'object') { const gradientHasMoreThanOneColour = this.state.gradientSettings.gradient.length > 1; @@ -209,8 +211,8 @@ export default class BackgroundSettings extends React.PureComponent { colourSettings = (
{gradientInputs} - {this.state.gradientSettings.gradient[0].colour !== this.props.language.disabled && - !gradientHasMoreThanOneColour ? () : null + {this.state.gradientSettings.gradient[0].colour !== background.disabled && + !gradientHasMoreThanOneColour ? () : null }
); @@ -222,23 +224,23 @@ export default class BackgroundSettings extends React.PureComponent {

Buttons

Effects

Source

diff --git a/src/components/modals/settings/sections/Greeting.jsx b/src/components/modals/settings/sections/Greeting.jsx index 042cc6c3..53c77b05 100644 --- a/src/components/modals/settings/sections/Greeting.jsx +++ b/src/components/modals/settings/sections/Greeting.jsx @@ -19,7 +19,7 @@ export default class GreetingSettings extends React.PureComponent { greetingName: '' }); - toast(this.props.toastLanguage.reset); + toast(this.props.language.toasts.reset); } changeDate(data) { @@ -40,20 +40,22 @@ export default class GreetingSettings extends React.PureComponent { } render() { + const { greeting } = this.props.language.sections; + return (
-

{this.props.language.title}

- - - +

{greeting.title}

+ + +
    -

    {this.props.language.name} this.resetItem()}>Reset

    +

    {greeting.name} this.resetItem()}>{this.props.language.buttons.reset}

    this.setState({ greetingName: e.target.value })}>
-

Birthday

- +

{greeting.birthday}

+
    -

    {this.props.language.birthday_date}

    +

    {greeting.birthday_date}

    this.changeDate(data)} value={this.state.birthday}/>
diff --git a/src/components/modals/settings/sections/Language.jsx b/src/components/modals/settings/sections/Language.jsx index 5f2e7edb..8efd7486 100644 --- a/src/components/modals/settings/sections/Language.jsx +++ b/src/components/modals/settings/sections/Language.jsx @@ -6,18 +6,14 @@ const languages = require('../../../../modules/languages.json'); export default function LanguageSettings (props) { return (
-

Language

-

{props.language.language}

- localStorage.setItem('language', document.getElementById('language').value)}> +

{props.language.title}

+ localStorage.setItem('language', document.getElementById('language').value)}> {languages.map(language => )} -

Quote {props.language.language}

- localStorage.setItem('quotelanguage', document.getElementById('quotelanguage').value)}> +
+ localStorage.setItem('quotelanguage', document.getElementById('quotelanguage').value)}> diff --git a/src/components/modals/settings/sections/Quote.jsx b/src/components/modals/settings/sections/Quote.jsx index d34df186..1ce31ce4 100644 --- a/src/components/modals/settings/sections/Quote.jsx +++ b/src/components/modals/settings/sections/Quote.jsx @@ -3,15 +3,17 @@ import React from 'react'; import Checkbox from '../Checkbox'; export default function QuoteSettings (props) { + const { quote } = props.language.sections; + return (
-

{props.language.title}

- - -

{props.language.buttons}

- - - +

{quote.title}

+ + +

{quote.buttons}

+ + +
); } diff --git a/src/components/modals/settings/sections/Search.jsx b/src/components/modals/settings/sections/Search.jsx index ddddd697..6b1fee97 100644 --- a/src/components/modals/settings/sections/Search.jsx +++ b/src/components/modals/settings/sections/Search.jsx @@ -55,24 +55,26 @@ export default class SearchSettings extends React.PureComponent { } render() { + const { search } = this.props.language.sections; + return (
-

{this.props.language.title}

- - +

{search.title}

+ +
    - this.setSearchEngine(document.getElementById('searchEngine').value)} > {searchEngines.map((engine) => )} - +
    -

    {this.props.language.custom} this.resetSearch()}>{this.props.language.reset}

    +

    {search.custom} this.resetSearch()}>{this.props.language.reset}

diff --git a/src/components/modals/settings/sections/Time.jsx b/src/components/modals/settings/sections/Time.jsx index d2136ff4..54fb19cb 100644 --- a/src/components/modals/settings/sections/Time.jsx +++ b/src/components/modals/settings/sections/Time.jsx @@ -26,24 +26,26 @@ export default class TimeSettings extends React.PureComponent { } render() { + const { time } = this.props.language.sections; + let digitalSettings = ( -

{this.props.language.digital.title}

- - - - +

{time.digital.title}

+ + + +
); let analogSettings = ( -

{this.props.language.analogue.title}

- - - - - +

{time.analogue.title}

+ + + + +
); @@ -55,27 +57,27 @@ export default class TimeSettings extends React.PureComponent { return (
-

{this.props.language.title}

- +

{time.title}

+ this.changeType()}> - - - + + + {digitalSettings} -

{this.props.language.date.title}

- - - - localStorage.setItem('dateFormat', document.getElementById('dateformat').value)}> +

{time.date.title}

+ + + + localStorage.setItem('dateFormat', document.getElementById('dateformat').value)}> - localStorage.setItem('shortFormat', document.getElementById('shortformat').value)}> - - - + localStorage.setItem('shortFormat', document.getElementById('shortformat').value)}> + + +
); diff --git a/src/components/modals/tabs/Settings.jsx b/src/components/modals/tabs/Settings.jsx index 10b32e8a..62ccfb34 100644 --- a/src/components/modals/tabs/Settings.jsx +++ b/src/components/modals/tabs/Settings.jsx @@ -17,28 +17,28 @@ export default function Settings (props) {
-
- +
- +
- +
- +
- +
-
- +
+
-
- +
+
diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index bf6a37ba..36e6172e 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -111,7 +111,7 @@ export default class Background extends React.PureComponent { this.setBackground(randomPhoto.url.default, null, randomPhoto.photographer); this.setCredit(randomPhoto.photographer); document.getElementById('location').textContent = randomPhoto.location; - } else if (customBackgroundColour) { + } else if (customBackgroundColour !== 'Disabled' && customBackgroundColour !== '') { this.setBackground(null, customBackgroundColour, 'false'); } else if (customBackground !== '') { if (customBackground.includes('.mp4') || customBackground.includes('.webm') || customBackground.includes('.ogg')) { diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index 0092e0b8..87301dbc 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -91,7 +91,9 @@ export default class Quote extends React.PureComponent { } let authorlink = `https://${this.props.languagecode.split('-')[0]}.wikipedia.org/wiki/${data.author.split(' ').join('_')}`; - if (localStorage.getItem('authorLink') === 'false') authorLink = null; + if (localStorage.getItem('authorLink') === 'false') { + authorLink = null; + } this.setState({ quote: '"' + data.quote + '"', diff --git a/src/scss/modules/_settings.scss b/src/scss/modules/_settings.scss index 1a356f59..c61ab1ce 100644 --- a/src/scss/modules/_settings.scss +++ b/src/scss/modules/_settings.scss @@ -1,16 +1,3 @@ -.switch { - position: relative; - width: 60px; - height: 34px; - float: right; - - input { - opacity: 0; - width: 0; - height: 0; - } -} - .hidden { display: none; } diff --git a/src/translations/en-GB.json b/src/translations/en-GB.json index 68e1e470..f0f017bf 100644 --- a/src/translations/en-GB.json +++ b/src/translations/en-GB.json @@ -80,6 +80,7 @@ "events": "Events", "default": "Default Greeting Message", "name": "Name for greeting", + "birthday": "Birthday", "birthday_date": "Birthday Date" }, "background": { @@ -103,7 +104,7 @@ "custom": "Custom Search URL", "voice_search": "Voice Search" }, - "appearance":{ + "appearance": { "title": "Appearance", "dark_theme": "Dark Theme", "night_mode": "Night Mode", @@ -115,7 +116,22 @@ "milliseconds": "milliseconds" } }, - "language": "Language", + "advanced": { + "title": "Advanced", + "offline_mode": "Offline Mode", + "data": "Data", + "customisation": "Customisation", + "custom_css": "Custom CSS", + "custom_js": "Custom JS", + "experimental_warning": "Please note that the Mue team cannot provide support if you have experimental mode on. Please disable it first and see if the issue continues to occur before contacting support." + }, + "experimental": { + "title": "Experimental" + }, + "language": { + "title": "Language", + "quote": "Quote Language" + }, "changelog": "Change Log", "about": { "title": "About", @@ -206,7 +222,7 @@ "title": "Give us feedback", "question_one": "How would you rate your experience of this Mue build?", "question_two": "What bugs did you encounter in your use of Mue?", - "question_three": "How likely would you be to recommend this version of Mue to a friend of colleague?", + "question_three": "How likely would you be to recommend this version of Mue to a friend or colleague?", "submit": "Submit" } }, diff --git a/src/translations/en-US.json b/src/translations/en-US.json index cba3f472..8e0ec380 100644 --- a/src/translations/en-US.json +++ b/src/translations/en-US.json @@ -15,6 +15,9 @@ "analogue": { "title": "Analog" } + }, + "advanced": { + "customisation": "Customization" } } }