2019-12-08 00:32:00 +05:30
|
|
|
import i18n from 'app/services/i18n';
|
2019-11-11 14:10:05 +05:30
|
|
|
|
2016-05-20 01:11:43 +05:30
|
|
|
import { SET_LOCALE } from './actions';
|
|
|
|
|
2019-12-07 16:58:52 +05:30
|
|
|
export type State = { locale: string };
|
2019-11-11 14:10:05 +05:30
|
|
|
|
|
|
|
const defaultState = {
|
2019-11-27 14:33:32 +05:30
|
|
|
locale: i18n.detectLanguage(),
|
2019-11-11 14:10:05 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export default function(
|
2019-11-27 14:33:32 +05:30
|
|
|
state: State = defaultState,
|
2019-12-07 16:58:52 +05:30
|
|
|
{ type, payload }: { type: string; payload: State },
|
2019-11-11 14:10:05 +05:30
|
|
|
): State {
|
2019-11-27 14:33:32 +05:30
|
|
|
if (type === SET_LOCALE) {
|
|
|
|
return payload;
|
|
|
|
}
|
2016-05-20 01:11:43 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
return state;
|
2016-05-20 01:11:43 +05:30
|
|
|
}
|