1
0
mirror of https://github.com/SomboChea/ui synced 2026-01-20 18:15:51 +07:00

fix(i18n): fixed current locale (#462)

* fix(i18n): fixed current locale

* Update i18n/translations/ja-JP.json

Co-Authored-By: hdmr14 <58992133+hdmr14@users.noreply.github.com>

Co-authored-by: hdmr14 <58992133+hdmr14@users.noreply.github.com>
This commit is contained in:
Priscila Oliveira
2020-04-27 21:36:40 +02:00
committed by GitHub
parent 730c3471c2
commit f44abd7dd0
11 changed files with 73 additions and 41 deletions

View File

@@ -3,15 +3,13 @@ import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';
import { ThemeProvider as EmotionThemeProvider } from 'emotion-theming';
import i18next from 'i18next';
import { Language } from '../../i18n/config';
import ThemeContext from './ThemeContext';
import { getTheme, ThemeMode } from './theme';
import useLocalStorage from './useLocalStorage';
const ThemeProvider: React.FC = ({ children }) => {
const isDarkModeDefault = window?.__VERDACCIO_BASENAME_UI_OPTIONS?.darkMode;
const currentLanguage: Language = i18next.language || i18next.options?.fallbackLng?.[0];
const currentLanguage = i18next.languages?.[0];
const [isDarkMode, setIsDarkMode] = useLocalStorage('darkMode', !!isDarkModeDefault);
const [language, setLanguage] = useLocalStorage('language', currentLanguage);