mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Updated profile settings. Refactored locale saving.
This commit is contained in:
parent
814589f6a5
commit
7f598fa84d
9 changed files with 82 additions and 30 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { Provider } from 'react-redux';
|
||||
import { useStore } from 'redux/store';
|
||||
|
|
@ -9,17 +9,10 @@ import 'styles/bootstrap-grid.css';
|
|||
import 'styles/index.css';
|
||||
|
||||
const Intl = ({ children }) => {
|
||||
const [locale, setLocale] = useLocale();
|
||||
const [locale] = useLocale();
|
||||
|
||||
const Wrapper = ({ children }) => <span className={locale}>{children}</span>;
|
||||
|
||||
useEffect(() => {
|
||||
const saved = localStorage.getItem('locale');
|
||||
if (saved) {
|
||||
setLocale(saved);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<IntlProvider locale={locale} messages={messages[locale]} textComponent={Wrapper}>
|
||||
{children}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue