We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc58187 commit a8a6d33Copy full SHA for a8a6d33
projects/fastgpt/components/header/LangSwitcher.tsx
@@ -19,13 +19,21 @@ export const LangSwitcher = () => {
19
const router = useRouter();
20
21
const handleSwitchLanguage = (value: string) => {
22
+ localStorage.setItem('preferredLang', value);
23
if (value === defaultLocale) {
24
router.push('/');
25
return;
26
}
27
router.push(value);
28
};
29
30
+ useEffect(() => {
31
+ const storedLang = localStorage.getItem('preferredLang');
32
+ if (storedLang && storedLang !== lang) {
33
+ router.push(storedLang);
34
+ }
35
+ }, []);
36
+
37
return (
38
<Select value={langName} onValueChange={handleSwitchLanguage}>
39
<SelectTrigger className="w-fit">
0 commit comments