move languages out of redux
This commit is contained in:
parent
9ef319341c
commit
a96ff9eb1a
5 changed files with 14 additions and 13 deletions
|
@ -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 => ({
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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%."
|
||||
}
|
Loading…
Add table
Reference in a new issue