mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
Cleaned up language files.
This commit is contained in:
parent
33b87b41a9
commit
92b205b7b7
6 changed files with 50 additions and 94 deletions
|
|
@ -4,6 +4,7 @@ import { setLocale } from 'redux/actions/app';
|
|||
import { useRouter } from 'next/router';
|
||||
import { get, setItem } from 'lib/web';
|
||||
import { LOCALE_CONFIG } from 'lib/constants';
|
||||
import { languages } from 'lib/lang';
|
||||
import useForceUpdate from 'hooks/useForceUpdate';
|
||||
import enUS from 'public/lang/en-US.json';
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ export default function useLocale() {
|
|||
const dispatch = useDispatch();
|
||||
const { basePath } = useRouter();
|
||||
const forceUpdate = useForceUpdate();
|
||||
const dir = languages[locale]?.dir || 'ltr';
|
||||
|
||||
async function loadMessages(locale) {
|
||||
const { ok, data } = await get(`${basePath}/lang/${locale}.json`);
|
||||
|
|
@ -45,5 +47,5 @@ export default function useLocale() {
|
|||
}
|
||||
}, [locale]);
|
||||
|
||||
return { locale, saveLocale, messages };
|
||||
return { locale, saveLocale, messages, dir };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue