mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-05 04:59:26 +05:30
23 lines
444 B
JavaScript
23 lines
444 B
JavaScript
// @flow
|
|
import i18n from 'services/i18n';
|
|
|
|
export const SET_LOCALE = 'i18n:setLocale';
|
|
export function setLocale(desiredLocale: string) {
|
|
return async (dispatch: (action: Object) => any): Promise<string> => {
|
|
const locale = i18n.detectLanguage(desiredLocale);
|
|
|
|
dispatch(_setLocale(locale));
|
|
|
|
return locale;
|
|
};
|
|
}
|
|
|
|
function _setLocale(locale: string) {
|
|
return {
|
|
type: SET_LOCALE,
|
|
payload: {
|
|
locale,
|
|
},
|
|
};
|
|
}
|