feat: Add i18n support for Chinese language (#142)

* feat: Add i18n support for Chinese language

* fix: locale not working in Docker environment
This commit is contained in:
Jungley
2023-03-25 23:42:48 +08:00
committed by GitHub
parent 932853f1ba
commit 92eab6c634
26 changed files with 320 additions and 40 deletions
+4 -2
View File
@@ -1,6 +1,7 @@
import { ChatFolder, Conversation } from "@/types";
import { IconFileExport, IconMoon, IconSun } from "@tabler/icons-react";
import { FC } from "react";
import { useTranslation } from "next-i18next";
import { ClearConversations } from "./ClearConversations";
import { Import } from "./Import";
import { Key } from "./Key";
@@ -17,6 +18,7 @@ interface Props {
}
export const SidebarSettings: FC<Props> = ({ lightMode, apiKey, onToggleLightMode, onApiKeyChange, onClearConversations, onExportConversations, onImportConversations }) => {
const { t} = useTranslation('sidebar')
return (
<div className="flex flex-col pt-1 items-center border-t border-white/20 text-sm space-y-1">
<ClearConversations onClearConversations={onClearConversations} />
@@ -24,13 +26,13 @@ export const SidebarSettings: FC<Props> = ({ lightMode, apiKey, onToggleLightMod
<Import onImport={onImportConversations} />
<SidebarButton
text="Export conversations"
text={t("Export conversations")}
icon={<IconFileExport size={16} />}
onClick={() => onExportConversations()}
/>
<SidebarButton
text={lightMode === "light" ? "Dark mode" : "Light mode"}
text={lightMode === "light" ? t("Dark mode") : t("Light mode")}
icon={lightMode === "light" ? <IconMoon size={16} /> : <IconSun size={16} />}
onClick={() => onToggleLightMode(lightMode === "light" ? "dark" : "light")}
/>