2019-12-08 00:32:00 +05:30
|
|
|
import i18n from 'app/services/i18n';
|
2019-11-11 14:10:05 +05:30
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
import { Action } from './actions';
|
2016-05-20 01:11:43 +05:30
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
export interface State {
|
2020-05-24 04:38:24 +05:30
|
|
|
locale: string;
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
2019-11-11 14:10:05 +05:30
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
const defaultState: State = {
|
2020-05-24 04:38:24 +05:30
|
|
|
locale: i18n.detectLanguage(),
|
2019-11-11 14:10:05 +05:30
|
|
|
};
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
export default function (state: State = defaultState, { type, payload }: Action): State {
|
|
|
|
if (type === 'i18n:setLocale') {
|
|
|
|
return payload;
|
|
|
|
}
|
2016-05-20 01:11:43 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
return state;
|
2016-05-20 01:11:43 +05:30
|
|
|
}
|