2019-12-07 21:02:00 +02:00
|
|
|
import i18n from 'app/services/i18n';
|
2019-11-11 10:40:05 +02:00
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
import { Action } from './actions';
|
2016-05-19 22:41:43 +03:00
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
export interface State {
|
2020-05-24 02:08:24 +03:00
|
|
|
locale: string;
|
2020-01-17 23:37:52 +03:00
|
|
|
}
|
2019-11-11 10:40:05 +02:00
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
const defaultState: State = {
|
2020-05-24 02:08:24 +03:00
|
|
|
locale: i18n.detectLanguage(),
|
2019-11-11 10:40:05 +02:00
|
|
|
};
|
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
export default function (state: State = defaultState, { type, payload }: Action): State {
|
|
|
|
if (type === 'i18n:setLocale') {
|
|
|
|
return payload;
|
|
|
|
}
|
2016-05-19 22:41:43 +03:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
return state;
|
2016-05-19 22:41:43 +03:00
|
|
|
}
|