From 07c9e6220569125f9f57abf30c2dc5cb0105d2c9 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Thu, 18 Mar 2021 11:42:00 +0000 Subject: [PATCH] fix: all settings tabs with translations and add quote author link setting --- .../modals/settings/sections/Appearance.jsx | 10 +++---- .../modals/settings/sections/Background.jsx | 8 +++--- .../modals/settings/sections/Greeting.jsx | 4 +-- .../modals/settings/sections/Quote.jsx | 1 + .../modals/settings/sections/Search.jsx | 6 ++--- .../modals/settings/sections/Time.jsx | 4 +-- src/components/modals/tabs/Settings.jsx | 12 ++++----- src/components/widgets/quote/Quote.jsx | 5 +++- src/translations/en-GB.json | 27 ++++++++++++++----- 9 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/components/modals/settings/sections/Appearance.jsx b/src/components/modals/settings/sections/Appearance.jsx index ea0335fb..768acc23 100644 --- a/src/components/modals/settings/sections/Appearance.jsx +++ b/src/components/modals/settings/sections/Appearance.jsx @@ -5,16 +5,16 @@ export default function AppearanceSettings (props) { return (

{props.language.title}

- - -

Accessibility

+ + +

{props.language.accessibility.title}

    -

    Zoom (100%) {props.language.reset}

    +

    {props.language.accessibility.zoom} (100%) Reset

    -

    Toast Duration (2500 milliseconds) {props.language.reset}

    +

    {props.language.accessibility.toast_duration} (2500 {props.language.accessibility.milliseconds}) {props.language.reset}

diff --git a/src/components/modals/settings/sections/Background.jsx b/src/components/modals/settings/sections/Background.jsx index 05f856f4..bd44c961 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.background.disabled, 'stop': 0 }], 'type': 'linear' }; + DefaultGradientSettings = { 'angle': '180', 'gradient': [{ 'colour': this.props.language.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.background.disabled)) { + if (typeof this.state.gradientSettings === 'object' && this.state.gradientSettings.gradient.every(g => g.colour !== this.props.language.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.background.disabled; + return this.props.language.disabled; } onColorPickerChange = (attrs, name) => { @@ -209,7 +209,7 @@ export default class BackgroundSettings extends React.PureComponent { colourSettings = (
{gradientInputs} - {this.state.gradientSettings.gradient[0].colour !== this.props.language.background.disabled && + {this.state.gradientSettings.gradient[0].colour !== this.props.language.disabled && !gradientHasMoreThanOneColour ? () : null }
diff --git a/src/components/modals/settings/sections/Greeting.jsx b/src/components/modals/settings/sections/Greeting.jsx index 5cf44092..042cc6c3 100644 --- a/src/components/modals/settings/sections/Greeting.jsx +++ b/src/components/modals/settings/sections/Greeting.jsx @@ -43,7 +43,7 @@ export default class GreetingSettings extends React.PureComponent { return (

{this.props.language.title}

- Enabled +
    @@ -51,7 +51,7 @@ export default class GreetingSettings extends React.PureComponent { this.setState({ greetingName: e.target.value })}>

Birthday

- +

    {this.props.language.birthday_date}

    this.changeDate(data)} value={this.state.birthday}/> diff --git a/src/components/modals/settings/sections/Quote.jsx b/src/components/modals/settings/sections/Quote.jsx index 1d2bddcd..d34df186 100644 --- a/src/components/modals/settings/sections/Quote.jsx +++ b/src/components/modals/settings/sections/Quote.jsx @@ -7,6 +7,7 @@ export default function QuoteSettings (props) {

    {props.language.title}

    +

    {props.language.buttons}

    diff --git a/src/components/modals/settings/sections/Search.jsx b/src/components/modals/settings/sections/Search.jsx index 15ab7ecd..ddddd697 100644 --- a/src/components/modals/settings/sections/Search.jsx +++ b/src/components/modals/settings/sections/Search.jsx @@ -57,8 +57,8 @@ export default class SearchSettings extends React.PureComponent { render() { return (
    -

    Search

    - +

    {this.props.language.title}

    +
      )} - +
      diff --git a/src/components/modals/settings/sections/Time.jsx b/src/components/modals/settings/sections/Time.jsx index 931ac4d8..d2136ff4 100644 --- a/src/components/modals/settings/sections/Time.jsx +++ b/src/components/modals/settings/sections/Time.jsx @@ -56,7 +56,7 @@ export default class TimeSettings extends React.PureComponent { return (

      {this.props.language.title}

      - + this.changeType()}> @@ -64,7 +64,7 @@ export default class TimeSettings extends React.PureComponent { {digitalSettings}

      {this.props.language.date.title}

      - + localStorage.setItem('dateFormat', document.getElementById('dateformat').value)}> diff --git a/src/components/modals/tabs/Settings.jsx b/src/components/modals/tabs/Settings.jsx index 4cffcc89..10b32e8a 100644 --- a/src/components/modals/tabs/Settings.jsx +++ b/src/components/modals/tabs/Settings.jsx @@ -17,21 +17,21 @@ export default function Settings (props) {
      -
      - +
      - +
      - +
      - +
      -
      +
      diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index 4def794f..0092e0b8 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -90,10 +90,13 @@ export default class Quote extends React.PureComponent { return this.doOffline(); } + let authorlink = `https://${this.props.languagecode.split('-')[0]}.wikipedia.org/wiki/${data.author.split(' ').join('_')}`; + if (localStorage.getItem('authorLink') === 'false') authorLink = null; + this.setState({ quote: '"' + data.quote + '"', author: data.author, - authorlink: `https://${this.props.languagecode}.wikipedia.org/wiki/${data.author.split(' ').join('_')}` + authorlink: authorlink }); } catch (e) { // ..and if that fails we load one locally diff --git a/src/translations/en-GB.json b/src/translations/en-GB.json index 150b291f..f71c6728 100644 --- a/src/translations/en-GB.json +++ b/src/translations/en-GB.json @@ -34,6 +34,7 @@ "marketplace": "Marketplace" }, "settings": { + "enabled": "Enabled", "sections": { "time": { "title": "Time", @@ -60,9 +61,9 @@ "short_format": "Short Format", "short_separator": { "title": "Short Separator", - "default": "Default", - "dash": "Dash", - "gaps": "Gaps" + "default": "Dots (.)", + "dash": "Dash (-)", + "gaps": "Gaps ( )" } } }, @@ -71,7 +72,8 @@ "buttons": "Buttons", "copy": "Copy", "tweet": "Tweet", - "favourite": "Favourite" + "favourite": "Favourite", + "author_link": "Author Link" }, "greeting": { "title": "Greeting", @@ -98,9 +100,21 @@ "search": { "title": "Search", "search_engine": "Search Engine", - "custom": "Custom Search URL" + "custom": "Custom Search URL", + "voice_search": "Voice Search" + }, + "appearance":{ + "title": "Appearance", + "dark_theme": "Dark Theme", + "night_mode": "Night Mode", + "animations": "Animations", + "accessibility": { + "title": "Accessibility", + "zoom": "Zoom", + "toast_duration": "Toast Duration", + "milliseconds": "milliseconds" + } }, - "appearance": "Appearance", "language": "Language", "changelog": "Change Log", "about": { @@ -121,7 +135,6 @@ } }, "buttons": { - "apply": "Apply", "reset": "Reset", "import": "Import", "export": "Export"