From a96ff9eb1a49e62b8c9e2ec30f8951a116cac9a0 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 3 Oct 2019 12:55:21 -0400 Subject: [PATCH] move languages out of redux --- src/ui/component/settingLanguage/index.js | 3 +-- src/ui/component/settingLanguage/view.jsx | 7 ++++--- src/ui/redux/reducers/settings.js | 1 - src/ui/redux/selectors/settings.js | 5 ----- static/app-strings.json | 11 +++++++++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/ui/component/settingLanguage/index.js b/src/ui/component/settingLanguage/index.js index e8852ff27..c024753ae 100644 --- a/src/ui/component/settingLanguage/index.js +++ b/src/ui/component/settingLanguage/index.js @@ -1,13 +1,12 @@ import { connect } from 'react-redux'; import * as SETTINGS from 'constants/settings'; import { doSetClientSetting } from 'redux/actions/settings'; -import { makeSelectClientSetting, selectLanguages } from 'redux/selectors/settings'; +import { makeSelectClientSetting } from 'redux/selectors/settings'; import { doToast } from 'lbry-redux'; import SettingLanguage from './view'; const select = state => ({ language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state), - languages: selectLanguages(state), }); const perform = dispatch => ({ diff --git a/src/ui/component/settingLanguage/view.jsx b/src/ui/component/settingLanguage/view.jsx index 444e0efa1..8856ca653 100644 --- a/src/ui/component/settingLanguage/view.jsx +++ b/src/ui/component/settingLanguage/view.jsx @@ -7,7 +7,6 @@ import { SETTINGS } from 'lbry-redux'; type Props = { language: string, - languages: {}, showToast: ({}) => void, setClientSetting: (string, boolean) => void, }; @@ -15,7 +14,10 @@ type Props = { function SettingLanguage(props: Props) { const [isFetching, setIsFetching] = useState(false); - const { language, languages, showToast, setClientSetting } = props; + // this should be fetched from lbry.com/transifex + const languages = { en: 'English', pl: 'Polski', id: 'Bahasa Indonesia', de: 'Deutsche' }; + + const { language, showToast, setClientSetting } = props; function onLanguageChange(e) { const { value } = e.target; @@ -33,7 +35,6 @@ function SettingLanguage(props: Props) { setClientSetting(SETTINGS.LANGUAGE, value); }) .catch(e => { - console.log(e); showToast({ message: __('Failed to load translations.'), error: true, diff --git a/src/ui/redux/reducers/settings.js b/src/ui/redux/reducers/settings.js index 5ab039a7d..7a482a8a1 100644 --- a/src/ui/redux/reducers/settings.js +++ b/src/ui/redux/reducers/settings.js @@ -5,7 +5,6 @@ import moment from 'moment'; const reducers = {}; const defaultState = { isNight: false, - languages: { en: 'English', pl: 'Polski', id: 'Bahasa Indonesia', de: 'Deutsche', tr: `Türkçe` }, // this could/should be loaded directly from Transifex and/or lbry.com isFetchingLanguage: false, daemonSettings: {}, clientSettings: { diff --git a/src/ui/redux/selectors/settings.js b/src/ui/redux/selectors/settings.js index 72d52ce0a..e7a0b5f71 100644 --- a/src/ui/redux/selectors/settings.js +++ b/src/ui/redux/selectors/settings.js @@ -27,11 +27,6 @@ export const makeSelectClientSetting = setting => // refactor me export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE); -export const selectLanguages = createSelector( - selectState, - state => state.languages -); - export const selectTheme = makeSelectClientSetting(SETTINGS.THEME); export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED); export const selectIsNight = createSelector( diff --git a/static/app-strings.json b/static/app-strings.json index 5ee0efc4f..ec47fd4e9 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -723,5 +723,12 @@ "Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.": "Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.", "This will add a Support button along side tipping. Similar to tips, supports help %discovery_link% but the LBC is returned to your wallet if revoked. Both also help secure your %vanity_names_link%.": "This will add a Support button along side tipping. Similar to tips, supports help %discovery_link% but the LBC is returned to your wallet if revoked. Both also help secure your %vanity_names_link%.", "Save Password": "Save Password", - "Automatically unlock your wallet on startup": "Automatically unlock your wallet on startup" -} + "Automatically unlock your wallet on startup": "Automatically unlock your wallet on startup", + "Dark": "Dark", + "light": "light", + "dark": "dark", + "Live help is available most hours in the %channel% channel of our Discord chat room. Or you can always email us at help@lbry.com.": "Live help is available most hours in the %channel% channel of our Discord chat room. Or you can always email us at help@lbry.com.", + "Your LBRY credits are controllable by you and only you, via a wallet file stored locally on your computer.": "Your LBRY credits are controllable by you and only you, via a wallet file stored locally on your computer.", + "However, it is easy to back up manually. To backup your wallet, make a copy of the folder listed below:": "However, it is easy to back up manually. To backup your wallet, make a copy of the folder listed below:", + "Access to these files are equivalent to having access to your credits. Keep any copies you make of your wallet in a secure place. For more details on backing up and best practices %helpLink%.": "Access to these files are equivalent to having access to your credits. Keep any copies you make of your wallet in a secure place. For more details on backing up and best practices %helpLink%." +} \ No newline at end of file