diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2019-03-04 16:31:36 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-03-07 13:48:30 +0100 |
| commit | 99ea926d8e9d529bd579ca79b15eb14ac7b87b00 (patch) | |
| tree | c899667d2ae06f1d5ed41cd8aef4a9fe3e42ee4b | |
| parent | 0d39e1a93b74ca37979171c4105e7c2e97d31892 (diff) | |
| download | mullvadvpn-99ea926d8e9d529bd579ca79b15eb14ac7b87b00.tar.xz mullvadvpn-99ea926d8e9d529bd579ca79b15eb14ac7b87b00.zip | |
Expose the locale via route props
| -rw-r--r-- | gui/src/renderer/app.tsx | 7 | ||||
| -rw-r--r-- | gui/src/renderer/containers/AccountPage.tsx | 6 | ||||
| -rw-r--r-- | gui/src/renderer/containers/SettingsPage.tsx | 3 | ||||
| -rw-r--r-- | gui/src/renderer/routes.tsx | 1 |
4 files changed, 12 insertions, 5 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index d039b24a43..af584edfdc 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -174,7 +174,12 @@ export default class AppRenderer { public renderView() { return ( <Provider store={this.reduxStore}> - <ConnectedRouter history={this.memoryHistory}>{makeRoutes({ app: this })}</ConnectedRouter> + <ConnectedRouter history={this.memoryHistory}> + {makeRoutes({ + app: this, + locale: remote.app.getLocale(), + })} + </ConnectedRouter> </Provider> ); } diff --git a/gui/src/renderer/containers/AccountPage.tsx b/gui/src/renderer/containers/AccountPage.tsx index 33dad1e1cb..9edd159e1c 100644 --- a/gui/src/renderer/containers/AccountPage.tsx +++ b/gui/src/renderer/containers/AccountPage.tsx @@ -1,5 +1,5 @@ import { goBack } from 'connected-react-router'; -import { remote, shell } from 'electron'; +import { shell } from 'electron'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { links } from '../../config.json'; @@ -8,10 +8,10 @@ import Account from '../components/Account'; import { IReduxState, ReduxDispatch } from '../redux/store'; import { ISharedRouteProps } from '../routes'; -const mapStateToProps = (state: IReduxState) => ({ +const mapStateToProps = (state: IReduxState, props: ISharedRouteProps) => ({ accountToken: state.account.accountToken, accountExpiry: state.account.expiry, - expiryLocale: remote.app.getLocale(), + expiryLocale: props.locale, isOffline: state.connection.isBlocked, }); const mapDispatchToProps = (dispatch: ReduxDispatch, props: ISharedRouteProps) => { diff --git a/gui/src/renderer/containers/SettingsPage.tsx b/gui/src/renderer/containers/SettingsPage.tsx index da4a10cdb2..e8a9c8ee9a 100644 --- a/gui/src/renderer/containers/SettingsPage.tsx +++ b/gui/src/renderer/containers/SettingsPage.tsx @@ -7,9 +7,10 @@ import Settings from '../components/Settings'; import { IReduxState, ReduxDispatch } from '../redux/store'; import { ISharedRouteProps } from '../routes'; -const mapStateToProps = (state: IReduxState) => ({ +const mapStateToProps = (state: IReduxState, props: ISharedRouteProps) => ({ loginState: state.account.status, accountExpiry: state.account.expiry, + expiryLocale: props.locale, appVersion: state.version.current, consistentVersion: state.version.consistent, upToDateVersion: state.version.upToDate, diff --git a/gui/src/renderer/routes.tsx b/gui/src/renderer/routes.tsx index 7aaf15d1e7..a31dd0de4a 100644 --- a/gui/src/renderer/routes.tsx +++ b/gui/src/renderer/routes.tsx @@ -16,6 +16,7 @@ import { getTransitionProps } from './transitions'; export interface ISharedRouteProps { app: App; + locale: string; } type CustomRouteProps = { |
