2021-02-04 19:15:23 +01:00
|
|
|
import * as actionConstants from '../../store/actionConstants';
|
2018-03-16 01:29:45 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export default function reduceLocaleMessages(state = {}, { type, value }) {
|
2020-02-06 17:38:14 +01:00
|
|
|
switch (type) {
|
2020-01-09 04:34:58 +01:00
|
|
|
case actionConstants.SET_CURRENT_LOCALE:
|
2020-01-13 17:29:21 +01:00
|
|
|
return {
|
2020-02-06 17:38:14 +01:00
|
|
|
...state,
|
|
|
|
current: value.messages,
|
2022-12-21 18:31:06 +01:00
|
|
|
currentLocale: value.locale,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-03-16 01:29:45 +01:00
|
|
|
default:
|
2021-02-04 19:15:23 +01:00
|
|
|
return state;
|
2018-03-16 01:29:45 +01:00
|
|
|
}
|
|
|
|
}
|
2020-03-23 18:07:05 +01:00
|
|
|
|
2022-12-21 18:31:06 +01:00
|
|
|
export const getCurrentLocale = (state) => state.localeMessages.currentLocale;
|
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export const getCurrentLocaleMessages = (state) => state.localeMessages.current;
|
2020-03-23 18:07:05 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export const getEnLocaleMessages = (state) => state.localeMessages.en;
|