feat(locale): Added a locale setting in Settings app

This removes the need to rebuild the phone in order to change language
This commit is contained in:
Taso authored and Taso committed 2021-03-17 10:24:28 -04:00
1 parent 5c6538b340
commit a6e8c769c0
6 files changed
+82 -9

No files matched your search

+9 -2
View File
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import './Phone.css';
import './i18n';
import { Route } from 'react-router-dom';
@@ -33,11 +33,18 @@ import { usePhone } from './os/phone/hooks/usePhone';
import { useTranslation } from 'react-i18next';
function Phone() {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const { apps } = useApps();
const [settings] = useSettings();
// Set language from local storage
// This will only trigger on first mount & settings changes
useEffect(() => {
i18n.changeLanguage(settings.language.value).catch((e) => console.error(e));
}, [i18n, settings.language]);
useNuiService();
useKeyboardService();
usePhoneService();