restore i18n support

This commit is contained in:
d-kimsuon
2025-10-26 16:17:23 +09:00
parent fbbcb87f50
commit 24274a20ed
3 changed files with 13 additions and 22 deletions

View File

@@ -101,18 +101,7 @@ export const GlobalSidebar: FC<GlobalSidebarProps> = ({
<Trans id="settings.section.system_info" message="System Information" />
),
content: (
<Suspense
fallback={
<div className="h-full flex items-center justify-center p-4">
<div className="text-sm text-sidebar-foreground/70">
<Trans
id="system_info.loading"
message="Loading system information..."
/>
</div>
</div>
}
>
<Suspense fallback={<Loading />}>
<SystemInfoCard />
</Suspense>
),

View File

@@ -12,6 +12,7 @@ import {
} from "@/components/ui/select";
import { useTheme } from "@/hooks/useTheme";
import { projectDetailQuery, projectListQuery } from "../lib/api/queries";
import type { SupportedLocale } from "../lib/i18n/schema";
interface SettingsControlsProps {
openingProjectId: string;
@@ -87,16 +88,12 @@ export const SettingsControls: FC<SettingsControlsProps> = ({
updateConfig(newConfig);
};
const handleLocaleChange = async (value: string) => {
const handleLocaleChange = async (value: SupportedLocale) => {
const newConfig = {
...config,
locale: value as "ja" | "en",
locale: value,
};
updateConfig(newConfig, {
onSuccess: async () => {
window.location.reload();
},
});
updateConfig(newConfig);
};
const handleThemeChange = async (value: "light" | "dark" | "system") => {

View File

@@ -1,14 +1,19 @@
import { i18n } from "@lingui/core";
import { I18nProvider } from "@lingui/react";
import type { FC, PropsWithChildren } from "react";
import { type FC, type PropsWithChildren, useEffect } from "react";
import { useConfig } from "../../app/hooks/useConfig";
import { i18nMessages } from ".";
for (const { locale, messages } of i18nMessages) {
i18n.load(locale, messages);
}
i18n.activate("en");
export const LinguiClientProvider: FC<PropsWithChildren> = ({ children }) => {
const { config } = useConfig();
useEffect(() => {
i18n.activate(config.locale);
}, [config.locale]);
return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
};