fix the rest of warnings
This commit is contained in:
@ -2,7 +2,7 @@ import { ReactNode, useEffect, useState } from "react";
|
||||
import { IntlProvider as ReactIntlProvider } from "react-intl";
|
||||
|
||||
import { DefaultLocale } from "@/Components/IntlProvider/IntlProviderUtils";
|
||||
import {useLocale} from "@/Components/IntlProvider/useLocale";
|
||||
import { useLocale } from "@/Components/IntlProvider/useLocale";
|
||||
import enMessages from "@/translations/en.json";
|
||||
|
||||
const getMessages = (locale: string) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {ExternalStore} from "@snort/shared";
|
||||
import { ExternalStore } from "@snort/shared";
|
||||
|
||||
class LangStore extends ExternalStore<string | null> {
|
||||
setLang(s: string) {
|
||||
@ -11,4 +11,4 @@ class LangStore extends ExternalStore<string | null> {
|
||||
}
|
||||
}
|
||||
|
||||
export const LangOverride = new LangStore();
|
||||
export const LangOverride = new LangStore();
|
||||
|
@ -1,11 +1,11 @@
|
||||
import {useSyncExternalStore} from "react";
|
||||
import { useSyncExternalStore } from "react";
|
||||
|
||||
import {getLocale} from "@/Components/IntlProvider/IntlProviderUtils";
|
||||
import {LangOverride} from "@/Components/IntlProvider/langStore";
|
||||
import { getLocale } from "@/Components/IntlProvider/IntlProviderUtils";
|
||||
import { LangOverride } from "@/Components/IntlProvider/langStore";
|
||||
import useLogin from "@/Hooks/useLogin";
|
||||
|
||||
export function useLocale() {
|
||||
const {language} = useLogin(s => ({language: s.appData.item.preferences.language}));
|
||||
const { language } = useLogin(s => ({ language: s.appData.item.preferences.language }));
|
||||
const loggedOutLang = useSyncExternalStore(
|
||||
c => LangOverride.hook(c),
|
||||
() => LangOverride.snapshot(),
|
||||
@ -16,4 +16,4 @@ export function useLocale() {
|
||||
lang: locale.toLowerCase().split(/[_-]+/)[0],
|
||||
setOverride: (s: string) => LangOverride.setLang(s),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user