feat: implement i18n

This commit is contained in:
Henry Li
2026-01-20 14:06:47 +08:00
parent 33e6197f65
commit ac9ef30780
21 changed files with 455 additions and 69 deletions

View File

@@ -23,6 +23,7 @@ import { ThreadContext } from "@/components/workspace/messages/context";
import { ThreadTitle } from "@/components/workspace/thread-title";
import { Tooltip } from "@/components/workspace/tooltip";
import { Welcome } from "@/components/workspace/welcome";
import { useI18n } from "@/core/i18n/hooks";
import { useLocalSettings } from "@/core/settings";
import { type AgentThread } from "@/core/threads";
import { useSubmitThread, useThreadStream } from "@/core/threads/hooks";
@@ -31,6 +32,7 @@ import { uuid } from "@/core/utils/uuid";
import { cn } from "@/lib/utils";
export default function ChatPage() {
const { t } = useI18n();
const router = useRouter();
const [settings, setSettings] = useLocalSettings();
const { setOpen: setSidebarOpen } = useSidebar();
@@ -41,7 +43,6 @@ export default function ChatPage() {
setArtifacts,
selectedArtifact,
} = useArtifacts();
const { thread_id: threadIdFromPath } = useParams<{ thread_id: string }>();
const isNewThread = useMemo(
() => threadIdFromPath === "new",
@@ -117,7 +118,7 @@ export default function ChatPage() {
}}
>
<FilesIcon />
Artifacts
{t.common.artifacts}
</Button>
</Tooltip>
)}

View File

@@ -10,11 +10,13 @@ import {
WorkspaceContainer,
WorkspaceHeader,
} from "@/components/workspace/workspace-container";
import { useI18n } from "@/core/i18n/hooks";
import { useThreads } from "@/core/threads/hooks";
import { pathOfThread, titleOfThread } from "@/core/threads/utils";
import { formatTimeAgo } from "@/core/utils/datetime";
export default function ChatsPage() {
const { t } = useI18n();
const { data: threads } = useThreads();
const [search, setSearch] = useState("");
const filteredThreads = useMemo(() => {
@@ -31,7 +33,7 @@ export default function ChatsPage() {
<Input
type="search"
className="h-12 w-full max-w-(--container-width-md) text-xl"
placeholder="Search chats"
placeholder={t.chats.searchChats}
autoFocus
value={search}
onChange={(e) => setSearch(e.target.value)}