mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2026-02-09 15:54:22 +01:00
restore i18n support
This commit is contained in:
@@ -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>
|
||||
),
|
||||
|
||||
@@ -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") => {
|
||||
|
||||
@@ -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>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user