From fbba492ffa360fb25780b17a10c140587629f95a Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Sun, 9 Aug 2020 19:33:20 +0200 Subject: [PATCH 1/4] Allow filter placeholder to be translated --- src/js/components/Fields/FilterField.js | 3 ++- src/js/locale/en.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/components/Fields/FilterField.js b/src/js/components/Fields/FilterField.js index 0f397e3d..6c0d1967 100755 --- a/src/js/components/Fields/FilterField.js +++ b/src/js/components/Fields/FilterField.js @@ -3,6 +3,7 @@ import React from 'react'; import Link from '../Link'; import Icon from '../Icon'; +import { i18n } from '../../locale'; export default class FilterField extends React.Component { constructor(props) { @@ -68,7 +69,7 @@ export default class FilterField extends React.Component {
this.handleSubmit(e)}> this.activate()} onBlur={(e) => this.handleBlur()} diff --git a/src/js/locale/en.yaml b/src/js/locale/en.yaml index bd1f3b61..a59312b6 100755 --- a/src/js/locale/en.yaml +++ b/src/js/locale/en.yaml @@ -57,6 +57,7 @@ fields: items_to_add: label: Items to add placeholder: No items + filter: Filter filters: all: All thumbnails: Thumbnails @@ -509,4 +510,4 @@ modal: subtitle: 'Another user has shared their configuration with you. This includes:' do_you_want_to_import: Do you want to import this? import_now: Import now - successful: Import successful \ No newline at end of file + successful: Import successful From 62f58018c75be131a5743dec64a1e7aa8647fd41 Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Sun, 9 Aug 2020 19:39:15 +0200 Subject: [PATCH 2/4] Allow mute/unmute playback controls to be translated --- src/js/components/Fields/MuteControl.js | 5 +++-- src/js/locale/en.yaml | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/components/Fields/MuteControl.js b/src/js/components/Fields/MuteControl.js index c1c34b31..f743721f 100755 --- a/src/js/components/Fields/MuteControl.js +++ b/src/js/components/Fields/MuteControl.js @@ -1,20 +1,21 @@ import React, { memo } from 'react'; import Icon from '../Icon'; +import { I18n } from '../../locale'; export default memo((props) => { if (props.mute) { return ( ); } return ( ); }); diff --git a/src/js/locale/en.yaml b/src/js/locale/en.yaml index a59312b6..882ed29f 100755 --- a/src/js/locale/en.yaml +++ b/src/js/locale/en.yaml @@ -174,6 +174,8 @@ playback_controls: shuffle: Shuffle repeat: Repeat no_outputs: No outputs + mute: Mute + unmute: Unmute snapcast: enabled: Enabled show_disconnected_clients: Show disconnected clients From 2ba5f6ede61b21bc698b47c833928a1bb52da789 Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Sun, 9 Aug 2020 20:01:23 +0200 Subject: [PATCH 3/4] Allow process notifications in Mopidy middleware to be translated --- src/js/locale/en.yaml | 3 +++ src/js/services/mopidy/middleware.js | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/js/locale/en.yaml b/src/js/locale/en.yaml index 882ed29f..0bf9a79c 100755 --- a/src/js/locale/en.yaml +++ b/src/js/locale/en.yaml @@ -114,6 +114,9 @@ services: mopidy: title: Mopidy local: Local + adding_uris: 'Adding %{count} URI(s)' + searching_providers: 'Searching %{count} Mopidy providers' + loading_albums: 'Loading %{count} local albums' spotify: title: Spotify pusher: diff --git a/src/js/services/mopidy/middleware.js b/src/js/services/mopidy/middleware.js index b7a42e32..650a8707 100755 --- a/src/js/services/mopidy/middleware.js +++ b/src/js/services/mopidy/middleware.js @@ -3,6 +3,7 @@ import ReactGA from 'react-ga'; import Mopidy from 'mopidy'; import { sha256 } from 'js-sha256'; import { sampleSize } from 'lodash'; +import { i18n } from '../../locale'; import { generateGuid, uriSource, @@ -786,7 +787,7 @@ const MopidyMiddleware = (function () { // start our processor store.dispatch(uiActions.startProcess( 'MOPIDY_ENQUEUE_URIS_PROCESSOR', - `Adding ${action.uris.length} URI(s)`, + i18n('services.mopidy.adding_uris', { count: action.uris.length }), { batches, remaining: action.uris.length, @@ -1042,7 +1043,7 @@ const MopidyMiddleware = (function () { } else { store.dispatch(uiActions.startProcess( 'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR', - `Searching ${uri_schemes_total} Mopidy providers`, + i18n('services.mopidy.searching_providers', { count: uri_schemes_total }), { query: action.query, limit: action.limit, @@ -1871,7 +1872,7 @@ const MopidyMiddleware = (function () { // Start our process to load the full album objects store.dispatch(uiActions.startProcess( 'MOPIDY_LIBRARY_ALBUMS_PROCESSOR', - `Loading ${uris.length} local albums`, + i18n('services.mopidy.loading_albums', { count: uris.length }), { uris, total: uris.length, From 03bfce5112fad797187a57198a0e4af970c60de7 Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Sun, 9 Aug 2020 21:44:59 +0200 Subject: [PATCH 4/4] Allow artist albums dropdown fields to be translated --- src/js/locale/en.yaml | 11 +++++++++++ src/js/views/Artist.js | 16 ++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/js/locale/en.yaml b/src/js/locale/en.yaml index 0bf9a79c..6c3aa33d 100755 --- a/src/js/locale/en.yaml +++ b/src/js/locale/en.yaml @@ -238,6 +238,17 @@ artist: wiki: published: 'Published: %{date}' origin: 'Origin: ' + albums: + sort: + default: Default + name: Name + release_date: Date + track_count: Tracks + filter: + all: All + albums: Albums + singles: Singles + compilations: Compilations debug: title: Debug ui: diff --git a/src/js/views/Artist.js b/src/js/views/Artist.js index b43bfdb1..8f13f5ca 100755 --- a/src/js/views/Artist.js +++ b/src/js/views/Artist.js @@ -192,38 +192,38 @@ class Artist extends React.Component { const sort_options = [ { value: null, - label: 'Default', + label: i18n('artist.albums.sort.default'), }, { value: 'name', - label: 'Name', + label: i18n('artist.albums.sort.name'), }, { value: 'release_date', - label: 'Date', + label: i18n('artist.albums.sort.release_date'), }, { value: 'tracks_uris.length', - label: 'Tracks', + label: i18n('artist.albums.sort.track_count'), }, ]; const filter_options = [ { value: null, - label: 'All', + label: i18n('artist.albums.filter.all'), }, { value: 'album', - label: 'Albums', + label: i18n('artist.albums.filter.albums'), }, { value: 'single', - label: 'Singles', + label: i18n('artist.albums.filter.singles'), }, { value: 'compilation', - label: 'Compilations', + label: i18n('artist.albums.filter.compilations'), }, ];