|
|
@ -86,13 +86,21 @@ export const toggleSidebar = (): WalletAction => ({
|
|
|
|
|
|
|
|
|
|
|
|
export const fetchLocale = (locale: string): ThunkAction => (dispatch: Dispatch): void => {
|
|
|
|
export const fetchLocale = (locale: string): ThunkAction => (dispatch: Dispatch): void => {
|
|
|
|
fetch(`./l10n/${locale}.json`)
|
|
|
|
fetch(`./l10n/${locale}.json`)
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(response => {
|
|
|
|
|
|
|
|
if (response.ok) {
|
|
|
|
|
|
|
|
return response.json();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Error(response.statusText);
|
|
|
|
|
|
|
|
})
|
|
|
|
.then(messages => {
|
|
|
|
.then(messages => {
|
|
|
|
dispatch({
|
|
|
|
dispatch({
|
|
|
|
type: WALLET.SET_LANGUAGE,
|
|
|
|
type: WALLET.SET_LANGUAGE,
|
|
|
|
locale,
|
|
|
|
locale,
|
|
|
|
messages,
|
|
|
|
messages,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
console.error(error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|