LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
feat: add i18n — English and Chinese interface language support
nash_su3ec56cd643a2
diff --git a/src/App.tsx b/src/App.tsxindex c0728202..c114de6f 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -1,8 +1,9 @@import { useState, useEffect } from "react"import { open } from "@tauri-apps/plugin-dialog"+import i18n from "@/i18n"import { useWikiStore } from "@/stores/wiki-store"import { listDirectory, openProject } from "@/commands/fs"-import { getLastProject, saveLastProject, loadLlmConfig } from "@/lib/project-store"+import { getLastProject, saveLastProject, loadLlmConfig, loadLanguage } from "@/lib/project-store"import { AppLayout } from "@/components/layout/app-layout"import { WelcomeScreen } from "@/components/project/welcome-screen"import { CreateProjectDialog } from "@/components/project/create-project-dialog"@@ -25,6 +26,10 @@ function App() {if (savedConfig) {useWikiStore.getState().setLlmConfig(savedConfig)}+ const savedLang = await loadLanguage()+ if (savedLang) {+ await i18n.changeLanguage(savedLang)+ }const lastProject = await getLastProject()if (lastProject) {try {diff --git a/src/components/layout/file-tree.tsx b/src/components/layout/file-tree.tsxindex 0c8c07cf..45dfcd9a 100644--- a/src/components/layout/file-tree.tsx+++ b/src/components/layout/file-tree.tsx@@ -3,6 +3,7 @@ import { ChevronRight, ChevronDown, File, Folder } from "lucide-react"import { ScrollArea } from "@/components/ui/scroll-area"import { useWikiStore } from "@/stores/wiki-store"import type { FileNode } from "@/types/wiki"+import { useTranslation } from "react-i18next"function TreeNode({ node, depth }: { node: FileNode; depth: number }) {const [expanded, setExpanded] = useState(depth < 1)@@ -52,13 +53,14 @@ function TreeNode({ node, depth }: { node: FileNode; depth: number }) {}export function FileTree() {+ const { t } = useTranslation()const fileTree = useWikiStore((s) => s.fileTree)const project = useWikiStore((s) => s.project)if (!project) {return (<div className="flex h-full items-center justify-center p-4 text-sm text-muted-foreground">- No project open+ {t("fileTree.noProject")}</div>)}diff --git a/src/components/layout/icon-sidebar.tsx b/src/components/layout/icon-sidebar.tsxindex 729726d9..a3be5713 100644--- a/src/components/layout/icon-sidebar.tsx+++ b/src/components/layout/icon-sidebar.tsx@@ -4,16 +4,19 @@ import {import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"import { useWikiStore } from "@/stores/wiki-store"import { useReviewStore } from "@/stores/review-store"+import { useTranslation } from "react-i18next"import type { WikiState } from "@/stores/wiki-store"-const navItems: { view: WikiState["activeView"]; icon: typeof FileText; label: string }[] = [- { view: "wiki", icon: FileText, label: "Wiki" },- { view: "sources", icon: FolderOpen, label: "Sources" },- { view: "search", icon: Search, label: "Search" },- { view: "graph", icon: Network, label: "Graph" },- { view: "lint", icon: ClipboardCheck, label: "Lint" },- { view: "review", icon: ClipboardList, label: "Review" },- { view: "settings", icon: Settings, label: "Settings" },+type NavView = WikiState["activeView"]++const NAV_ITEMS: { view: NavView; icon: typeof FileText; labelKey: string }[] = [+ { view: "wiki", icon: FileText, labelKey: "nav.wiki" },+ { view: "sources", icon: FolderOpen, labelKey: "nav.sources" },+ { view: "search", icon: Search, labelKey: "nav.search" },+ { view: "graph", icon: Network, labelKey: "nav.graph" },+ { view: "lint", icon: ClipboardCheck, labelKey: "nav.lint" },+ { view: "review", icon: ClipboardList, labelKey: "nav.review" },+ { view: "settings", icon: Settings, labelKey: "nav.settings" },]interface IconSidebarProps {@@ -21,6 +24,7 @@ interface IconSidebarProps {}export function IconSidebar({ onSwitchProject }: IconSidebarProps) {+ const { t } = useTranslation()const activeView = useWikiStore((s) => s.activeView)const setActiveView = useWikiStore((s) => s.setActiveView)const pendingCount = useReviewStore((s) => s.items.filter((i) => !i.resolved).length)@@ -29,7 +33,7 @@ export function IconSidebar({ onSwitchProject }: IconSidebarProps) {<TooltipProvider delayDuration={300}><div className="flex h-full w-12 flex-col items-center border-r bg-muted/50 py-2"><div className="flex flex-1 flex-col items-center gap-1">- {navItems.map(({ view, icon: Icon, label }) => (+ {NAV_ITEMS.map(({ view, icon: Icon, labelKey }) => (<Tooltip key={view}><TooltipTriggeronClick={() => setActiveView(view)}@@ -47,7 +51,7 @@ export function IconSidebar({ onSwitchProject }: IconSidebarProps) {)}</TooltipTrigger><TooltipContent side="right">- {label}+ {t(labelKey)}{view === "review" && pendingCount > 0 && ` (${pendingCount})`}</TooltipContent></Tooltip>@@ -61,7 +65,7 @@ export function IconSidebar({ onSwitchProject }: IconSidebarProps) {><ArrowLeftRight className="h-5 w-5" /></TooltipTrigger>- <TooltipContent side="right">Switch Project</TooltipContent>+ <TooltipContent side="right">{t("nav.switchProject")}</TooltipContent></Tooltip></div></div>diff --git a/src/components/project/welcome-screen.tsx b/src/components/project/welcome-screen.tsxindex 4e87f4c3..bdf69815 100644--- a/src/components/project/welcome-screen.tsx+++ b/src/components/project/welcome-screen.tsx@@ -3,6 +3,7 @@ import { FolderOpen, Plus, Clock, X } from "lucide-react"import { Button } from "@/components/ui/button"import { getRecentProjects, removeFromRecentProjects } from "@/lib/project-store"import type { WikiProject } from "@/types/wiki"+import { useTranslation } from "react-i18next"interface WelcomeScreenProps {onCreateProject: () => void@@ -15,6 +16,7 @@ export function WelcomeScreen({onOpenProject,onSelectProject,}: WelcomeScreenProps) {+ const { t } = useTranslation()const [recentProjects, setRecentProjects] = useState<WikiProject[]>([])useEffect(() => {@@ -32,20 +34,20 @@ export function WelcomeScreen({<div className="flex h-full items-center justify-center bg-background"><div className="flex flex-col items-center gap-8 px-4"><div className="text-center">- <h1 className="text-3xl font-bold">LLM Wiki</h1>+ <h1 className="text-3xl font-bold">{t("app.title")}</h1><p className="mt-2 text-muted-foreground">- Build and maintain your personal knowledge base with LLMs+ {t("app.subtitle")}</p></div><div className="flex gap-3"><Button onClick={onCreateProject}><Plus className="mr-2 h-4 w-4" />- New Project+ {t("welcome.newProject")}</Button><Button variant="outline" onClick={onOpenProject}><FolderOpen className="mr-2 h-4 w-4" />- Open Project+ {t("welcome.openProject")}</Button></div>@@ -53,7 +55,7 @@ export function WelcomeScreen({<div className="w-full max-w-md"><div className="mb-2 flex items-center gap-2 text-sm text-muted-foreground"><Clock className="h-3.5 w-3.5" />- Recent Projects+ {t("welcome.recentProjects")}</div><div className="rounded-lg border">{recentProjects.map((proj) => (diff --git a/src/components/search/search-view.tsx b/src/components/search/search-view.tsxindex bad7a2f8..ff932fa2 100644--- a/src/components/search/search-view.tsx+++ b/src/components/search/search-view.tsx@@ -4,8 +4,10 @@ import { ScrollArea } from "@/components/ui/scroll-area"import { useWikiStore } from "@/stores/wiki-store"import { readFile } from "@/commands/fs"import { searchWiki, type SearchResult } from "@/lib/search"+import { useTranslation } from "react-i18next"export function SearchView() {+ const { t } = useTranslation()const project = useWikiStore((s) => s.project)const setSelectedFile = useWikiStore((s) => s.setSelectedFile)const setFileContent = useWikiStore((s) => s.setFileContent)@@ -64,7 +66,7 @@ export function SearchView() {type="text"value={query}onChange={(e) => setQuery(e.target.value)}- placeholder="Search wiki..."+ placeholder={t("search.placeholder")}autoFocusclassName="w-full rounded-md border bg-background py-2 pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"/>@@ -75,13 +77,13 @@ export function SearchView() {{!query.trim() ? (<div className="flex flex-col items-center justify-center gap-2 p-8 text-center text-sm text-muted-foreground"><Search className="h-8 w-8 text-muted-foreground/30" />- <p>Type to search wiki pages</p>+ <p>{t("search.startSearching")}</p></div>) : searching ? (<div className="p-4 text-center text-sm text-muted-foreground">Searching...</div>) : results.length === 0 ? (<div className="p-4 text-center text-sm text-muted-foreground">- No results for <span className="font-medium">"{query}"</span>+ {t("search.noResults")} <span className="font-medium">"{query}"</span></div>) : (<div className="flex flex-col gap-1 p-2">diff --git a/src/components/settings/settings-view.tsx b/src/components/settings/settings-view.tsxindex b6adf7b8..2022030d 100644--- a/src/components/settings/settings-view.tsx+++ b/src/components/settings/settings-view.tsx@@ -3,6 +3,9 @@ import { Button } from "@/components/ui/button"import { Input } from "@/components/ui/input"import { Label } from "@/components/ui/label"import { useState, useEffect } from "react"+import { useTranslation } from "react-i18next"+import i18n from "@/i18n"+import { saveLanguage } from "@/lib/project-store"const PROVIDERS = [{ value: "openai" as const, label: "OpenAI", models: ["gpt-4o", "gpt-4.1", "gpt-4o-mini"] },@@ -12,7 +15,13 @@ const PROVIDERS = [{ value: "custom" as const, label: "Custom", models: [] },]+const LANGUAGES = [+ { value: "en", label: "English" },+ { value: "zh", label: "中文" },+]+export function SettingsView() {+ const { t } = useTranslation()const llmConfig = useWikiStore((s) => s.llmConfig)const setLlmConfig = useWikiStore((s) => s.setLlmConfig)@@ -22,6 +31,7 @@ export function SettingsView() {const [ollamaUrl, setOllamaUrl] = useState(llmConfig.ollamaUrl)const [customEndpoint, setCustomEndpoint] = useState(llmConfig.customEndpoint)const [saved, setSaved] = useState(false)+ const [currentLang, setCurrentLang] = useState(i18n.language)useEffect(() => {setProvider(llmConfig.provider)@@ -42,17 +52,45 @@ export function SettingsView() {setTimeout(() => setSaved(false), 2000)}+ async function handleLanguageChange(lang: string) {+ await i18n.changeLanguage(lang)+ setCurrentLang(lang)+ await saveLanguage(lang)+ }+return (<div className="h-full overflow-auto p-8"><div className="mx-auto max-w-xl">- <h2 className="mb-6 text-2xl font-bold">Settings</h2>+ <h2 className="mb-6 text-2xl font-bold">{t("settings.title")}</h2><div className="space-y-6">+ {/* Language section */}+ <div className="space-y-4 rounded-lg border p-4">+ <h3 className="font-semibold">{t("settings.language")}</h3>+ <div className="flex flex-wrap gap-2">+ {LANGUAGES.map((lang) => (+ <button+ key={lang.value}+ onClick={() => handleLanguageChange(lang.value)}+ className={`rounded-md border px-3 py-1.5 text-sm transition-colors ${+ currentLang === lang.value+ ? "border-primary bg-primary text-primary-foreground"+ : "border-border hover:bg-accent"+ }`}+ >+ {lang.label}+ </button>+ ))}+ </div>+ <p className="text-xs text-muted-foreground">{t("settings.languageHint")}</p>+ </div>++ {/* LLM Provider section */}<div className="space-y-4 rounded-lg border p-4">- <h3 className="font-semibold">LLM Provider</h3>+ <h3 className="font-semibold">{t("settings.llmProvider")}</h3><div className="space-y-2">- <Label>Provider</Label>+ <Label>{t("settings.provider")}</Label><div className="flex flex-wrap gap-2">{PROVIDERS.map((p) => (<button@@ -75,7 +113,7 @@ export function SettingsView() {{provider === "custom" && (<div className="space-y-2">- <Label htmlFor="customEndpoint">API Endpoint (OpenAI-compatible)</Label>+ <Label htmlFor="customEndpoint">{t("settings.customEndpoint")}</Label><Inputid="customEndpoint"value={customEndpoint}@@ -83,14 +121,14 @@ export function SettingsView() {placeholder="https://your-api.example.com/v1"/><p className="text-xs text-muted-foreground">- Any OpenAI-compatible API endpoint (e.g., LiteLLM, vLLM, LocalAI, Azure OpenAI)+ {t("settings.customEndpointHint")}</p></div>)}{provider === "ollama" && (<div className="space-y-2">- <Label htmlFor="ollamaUrl">Ollama URL</Label>+ <Label htmlFor="ollamaUrl">{t("settings.ollamaUrl")}</Label><Inputid="ollamaUrl"value={ollamaUrl}@@ -102,7 +140,7 @@ export function SettingsView() {{provider !== "ollama" && (<div className="space-y-2">- <Label htmlFor="apiKey">API Key</Label>+ <Label htmlFor="apiKey">{t("settings.apiKey")}</Label><Inputid="apiKey"type="password"@@ -110,15 +148,15 @@ export function SettingsView() {onChange={(e) => setApiKey(e.target.value)}placeholder={provider === "custom"- ? "Enter API key (if required)"- : `Enter your ${currentProvider?.label} API key`+ ? t("settings.customApiKey")+ : t("settings.apiKeyPlaceholder", { provider: currentProvider?.label })}/></div>)}<div className="space-y-2">- <Label htmlFor="model">Model</Label>+ <Label htmlFor="model">{t("settings.model")}</Label>{currentProvider && currentProvider.models.length > 0 ? (<div className="space-y-2"><div className="flex flex-wrap gap-2">@@ -139,7 +177,7 @@ export function SettingsView() {<Inputvalue={model}onChange={(e) => setModel(e.target.value)}- placeholder="Or type a custom model name"+ placeholder={t("settings.customModel")}/></div>) : (@@ -147,18 +185,14 @@ export function SettingsView() {id="model"value={model}onChange={(e) => setModel(e.target.value)}- placeholder={- provider === "ollama"- ? "Enter model name (e.g., llama3)"- : "Enter model name"- }+ placeholder={t("settings.modelPlaceholder")}/>)}</div></div><Button onClick={handleSave} className="w-full">- {saved ? "Saved!" : "Save Settings"}+ {saved ? t("settings.saved") : t("settings.save")}</Button></div></div>diff --git a/src/components/sources/sources-view.tsx b/src/components/sources/sources-view.tsxindex 9adf877b..87f177f6 100644--- a/src/components/sources/sources-view.tsx+++ b/src/components/sources/sources-view.tsx@@ -7,8 +7,10 @@ import { useWikiStore } from "@/stores/wiki-store"import { copyFile, listDirectory, readFile, writeFile, deleteFile, findRelatedWikiPages, preprocessFile } from "@/commands/fs"import type { FileNode } from "@/types/wiki"import { startIngest, autoIngest } from "@/lib/ingest"+import { useTranslation } from "react-i18next"export function SourcesView() {+ const { t } = useTranslation()const project = useWikiStore((s) => s.project)const selectedFile = useWikiStore((s) => s.selectedFile)const setSelectedFile = useWikiStore((s) => s.setSelectedFile)@@ -123,7 +125,7 @@ export function SourcesView() {if (!project) returnconst fileName = node.nameconst confirmed = window.confirm(- `Delete "${fileName}" and its related wiki pages?\n\nThis will:\n- Delete the source file\n- Delete wiki pages generated from this source\n- Update index.md`+ t("sources.deleteConfirm", { name: fileName }))if (!confirmed) return@@ -194,14 +196,14 @@ export function SourcesView() {return (<div className="flex h-full flex-col"><div className="flex items-center justify-between border-b px-4 py-3">- <h2 className="text-sm font-semibold">Raw Sources</h2>+ <h2 className="text-sm font-semibold">{t("sources.title")}</h2><div className="flex gap-1"><Button variant="ghost" size="icon" onClick={loadSources} title="Refresh"><RefreshCw className="h-4 w-4" /></Button><Button size="sm" onClick={handleImport} disabled={importing}><Plus className="mr-1 h-4 w-4" />- {importing ? "Importing..." : "Import"}+ {importing ? t("sources.importing") : t("sources.import")}</Button></div></div>@@ -209,11 +211,11 @@ export function SourcesView() {<ScrollArea className="flex-1">{sources.length === 0 ? (<div className="flex flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground">- <p>No sources yet</p>- <p>Import documents to start building your wiki</p>+ <p>{t("sources.noSources")}</p>+ <p>{t("sources.importHint")}</p><Button variant="outline" size="sm" onClick={handleImport}><Plus className="mr-1 h-4 w-4" />- Import Files+ {t("sources.importFiles")}</Button></div>) : (@@ -234,7 +236,7 @@ export function SourcesView() {variant="ghost"size="icon"className="h-7 w-7 shrink-0"- title="Ingest into wiki"+ title={t("sources.ingest")}disabled={ingestingPath === source.path}onClick={() => handleIngest(source)}>@@ -244,7 +246,7 @@ export function SourcesView() {variant="ghost"size="icon"className="h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive"- title="Delete source and related wiki pages"+ title={t("sources.delete")}onClick={() => handleDelete(source)}><Trash2 className="h-3.5 w-3.5" />@@ -256,7 +258,7 @@ export function SourcesView() {</ScrollArea><div className="border-t px-4 py-2 text-xs text-muted-foreground">- {sources.length} source{sources.length !== 1 ? "s" : ""}+ {t("sources.sourceCount", { count: sources.length })}</div></div>)diff --git a/src/i18n/en.json b/src/i18n/en.jsonnew file mode 100644index 00000000..fe7f8b6d--- /dev/null+++ b/src/i18n/en.json@@ -0,0 +1,109 @@+{+ "app": {+ "title": "LLM Wiki",+ "subtitle": "Build and maintain your personal knowledge base with LLMs"+ },+ "nav": {+ "wiki": "Wiki",+ "sources": "Sources",+ "search": "Search",+ "graph": "Graph",+ "lint": "Lint",+ "review": "Review",+ "settings": "Settings",+ "switchProject": "Switch Project"+ },+ "welcome": {+ "newProject": "New Project",+ "openProject": "Open Project",+ "recentProjects": "Recent Projects"+ },+ "project": {+ "createTitle": "Create New Wiki Project",+ "name": "Project Name",+ "namePlaceholder": "my-research-wiki",+ "parentDir": "Parent Directory",+ "template": "Template",+ "cancel": "Cancel",+ "create": "Create",+ "creating": "Creating..."+ },+ "sources": {+ "title": "Raw Sources",+ "import": "Import",+ "importing": "Importing...",+ "noSources": "No sources yet",+ "importHint": "Import documents to start building your wiki",+ "importFiles": "Import Files",+ "ingest": "Ingest",+ "delete": "Delete source and related wiki pages",+ "deleteConfirm": "Delete \"{{name}}\" and its related wiki pages?\n\nThis will:\n- Delete the source file\n- Delete wiki pages generated from this source\n- Update index.md",+ "sourceCount": "{{count}} source",+ "sourceCount_plural": "{{count}} sources"+ },+ "chat": {+ "placeholder": "Ask about your wiki...",+ "ingestPlaceholder": "Discuss the source or ask follow-up questions...",+ "saveToWiki": "Save to Wiki",+ "saving": "Saving...",+ "saved": "Saved!",+ "writeToWiki": "Write to Wiki",+ "emptyHint": "Ask a question or start an ingest to begin.",+ "sources": "Sources"+ },+ "search": {+ "title": "Search",+ "placeholder": "Search wiki pages...",+ "noResults": "No results found",+ "startSearching": "Type to search wiki pages"+ },+ "lint": {+ "title": "Lint",+ "runLint": "Run Lint",+ "running": "Running...",+ "semantic": "Semantic (LLM)",+ "allClear": "All clear — no issues found",+ "orphan": "Orphan Page",+ "brokenLink": "Broken Link",+ "noOutlinks": "No Outbound Links",+ "contradiction": "Contradiction",+ "stale": "Stale Content",+ "missingPage": "Missing Page",+ "suggestion": "Suggestion"+ },+ "review": {+ "title": "Review",+ "clearResolved": "Clear resolved",+ "allClear": "All clear — nothing to review"+ },+ "settings": {+ "title": "Settings",+ "llmProvider": "LLM Provider",+ "provider": "Provider",+ "apiKey": "API Key",+ "apiKeyPlaceholder": "Enter your {{provider}} API key",+ "model": "Model",+ "customModel": "Or type a custom model name",+ "ollamaUrl": "Ollama URL",+ "customEndpoint": "API Endpoint (OpenAI-compatible)",+ "customEndpointHint": "Any OpenAI-compatible API endpoint (e.g., LiteLLM, vLLM, LocalAI, Azure OpenAI)",+ "customApiKey": "Enter API key (if required)",+ "modelPlaceholder": "Enter model name",+ "save": "Save Settings",+ "saved": "Saved!",+ "language": "Language",+ "languageHint": "Interface language (wiki content follows source material language)"+ },+ "preview": {+ "selectFile": "Select a file to preview",+ "notAvailable": "Preview not available for this file type"+ },+ "activity": {+ "processing": "Processing: {{title}}",+ "done": "Done: {{title}}",+ "clearCompleted": "Clear completed"+ },+ "fileTree": {+ "noProject": "No project open"+ }+}diff --git a/src/i18n/index.ts b/src/i18n/index.tsnew file mode 100644index 00000000..4ed0c995--- /dev/null+++ b/src/i18n/index.ts@@ -0,0 +1,16 @@+import i18n from "i18next"+import { initReactI18next } from "react-i18next"+import en from "./en.json"+import zh from "./zh.json"++i18n.use(initReactI18next).init({+ resources: {+ en: { translation: en },+ zh: { translation: zh },+ },+ lng: "en",+ fallbackLng: "en",+ interpolation: { escapeValue: false },+})++export default i18ndiff --git a/src/i18n/zh.json b/src/i18n/zh.jsonnew file mode 100644index 00000000..bcf30303--- /dev/null+++ b/src/i18n/zh.json@@ -0,0 +1,109 @@+{+ "app": {+ "title": "LLM Wiki",+ "subtitle": "用 LLM 构建和维护你的个人知识库"+ },+ "nav": {+ "wiki": "Wiki",+ "sources": "原始资料",+ "search": "搜索",+ "graph": "关系图",+ "lint": "检查",+ "review": "待审阅",+ "settings": "设置",+ "switchProject": "切换项目"+ },+ "welcome": {+ "newProject": "新建项目",+ "openProject": "打开项目",+ "recentProjects": "最近项目"+ },+ "project": {+ "createTitle": "新建 Wiki 项目",+ "name": "项目名称",+ "namePlaceholder": "my-research-wiki",+ "parentDir": "父目录",+ "template": "模板",+ "cancel": "取消",+ "create": "创建",+ "creating": "创建中..."+ },+ "sources": {+ "title": "原始资料",+ "import": "导入",+ "importing": "导入中...",+ "noSources": "暂无资料",+ "importHint": "导入文档,开始构建你的 Wiki",+ "importFiles": "导入文件",+ "ingest": "提取到 Wiki",+ "delete": "删除资料及相关 Wiki 页面",+ "deleteConfirm": "删除「{{name}}」及其相关 Wiki 页面?\n\n此操作将:\n- 删除原始资料文件\n- 删除由该资料生成的 Wiki 页面\n- 更新 index.md",+ "sourceCount": "{{count}} 个资料",+ "sourceCount_plural": "{{count}} 个资料"+ },+ "chat": {+ "placeholder": "向你的 Wiki 提问...",+ "ingestPlaceholder": "讨论资料内容或继续追问...",+ "saveToWiki": "保存到 Wiki",+ "saving": "保存中...",+ "saved": "已保存!",+ "writeToWiki": "写入 Wiki",+ "emptyHint": "提问或开始提取资料。",+ "sources": "来源"+ },+ "search": {+ "title": "搜索",+ "placeholder": "搜索 Wiki 页面...",+ "noResults": "未找到相关结果",+ "startSearching": "输入关键词搜索 Wiki 页面"+ },+ "lint": {+ "title": "检查",+ "runLint": "开始检查",+ "running": "检查中...",+ "semantic": "语义检查(LLM)",+ "allClear": "一切正常,未发现问题",+ "orphan": "孤立页面",+ "brokenLink": "失效链接",+ "noOutlinks": "无出链",+ "contradiction": "内容矛盾",+ "stale": "内容过时",+ "missingPage": "缺失页面",+ "suggestion": "建议"+ },+ "review": {+ "title": "待审阅",+ "clearResolved": "清除已解决",+ "allClear": "一切正常,无需审阅"+ },+ "settings": {+ "title": "设置",+ "llmProvider": "LLM 提供商",+ "provider": "提供商",+ "apiKey": "API 密钥",+ "apiKeyPlaceholder": "请输入你的 {{provider}} API 密钥",+ "model": "模型",+ "customModel": "或手动输入模型名称",+ "ollamaUrl": "Ollama 地址",+ "customEndpoint": "API 端点(OpenAI 兼容)",+ "customEndpointHint": "任何兼容 OpenAI 的 API 端点(如 LiteLLM、vLLM、LocalAI、Azure OpenAI)",+ "customApiKey": "请输入 API 密钥(如需要)",+ "modelPlaceholder": "请输入模型名称",+ "save": "保存设置",+ "saved": "已保存!",+ "language": "语言",+ "languageHint": "界面语言(Wiki 内容语言以原始资料为准)"+ },+ "preview": {+ "selectFile": "选择文件以预览",+ "notAvailable": "该文件类型暂不支持预览"+ },+ "activity": {+ "processing": "处理中:{{title}}",+ "done": "已完成:{{title}}",+ "clearCompleted": "清除已完成"+ },+ "fileTree": {+ "noProject": "未打开项目"+ }+}diff --git a/src/lib/project-store.ts b/src/lib/project-store.tsindex a8fec79f..108d28cc 100644--- a/src/lib/project-store.ts+++ b/src/lib/project-store.ts@@ -58,3 +58,15 @@ export async function removeFromRecentProjects(const updated = existing.filter((p) => p.path !== path)await store.set(RECENT_PROJECTS_KEY, updated)}++const LANGUAGE_KEY = "language"++export async function saveLanguage(lang: string): Promise<void> {+ const store = await getStore()+ await store.set(LANGUAGE_KEY, lang)+}++export async function loadLanguage(): Promise<string | null> {+ const store = await getStore()+ return (await store.get<string>(LANGUAGE_KEY)) ?? null+}diff --git a/src/main.tsx b/src/main.tsxindex 02055fd7..ecfe6155 100644--- a/src/main.tsx+++ b/src/main.tsx@@ -2,6 +2,7 @@ import React from "react";import ReactDOM from "react-dom/client";import App from "./App";import "./index.css";+import "@/i18n";ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(<React.StrictMode>