Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

Add bilingual localization support

yomadea5d6b3a71a
diff --git a/README.en-US.md b/README.en-US.md
new file mode 100644
index 00000000..92155a54
--- /dev/null
+++ b/README.en-US.md
@@ -0,0 +1,196 @@
+# EdgeEver
+
+[简体中文](README.md) | [English](README.en-US.md)
+
+> **EdgeEver: A self-hosted, Cloudflare-native Evernote alternative.**
+
+EdgeEver is an open-source, self-hosted, Cloudflare-native notes workspace. It keeps the classic Evernote-style three-pane experience while providing a clear data model, REST API, OpenAPI schema, and Remote MCP endpoint.
+
+With Cloudflare's free quotas, a personal deployment can run at nearly zero long-term cost.
+
+## Why EdgeEver
+
+Many long-time Evernote users only need a reliable, open, responsive personal knowledge base. But modern commercial notes apps are often heavier than necessary, harder to migrate away from, and increasingly shaped by subscription and add-on features.
+
+EdgeEver fills that gap: familiar notes interaction, open data, API access, MCP support, and self-hosted deployment that is practical for individuals.
+
+## Online Demo
+
+- Demo: [https://demo.edgeever.org](https://demo.edgeever.org)
+- Username: `ee-demo`
+- Password: `demo#dZ6Q29Zjfor%`
+
+The public demo resets daily and restores sample notes. Do not store private content there.
+
+## Deployment
+
+Fork this repository to your own GitHub account first, then deploy from your fork. When EdgeEver ships updates, you can use GitHub's **Sync fork** button and redeploy to Cloudflare.
+
+### Deploy with an AI Agent
+
+Copy this prompt into your AI coding assistant, such as Claude Code, Codex, Antigravity, Cursor, or Trae:
+
+```text
+Please fork the EdgeEver repository first: https://github.com/msh01/edgeever
+
+After the fork is ready, use the forked repository to install and deploy EdgeEver to Cloudflare, and configure automatic upstream sync for the fork so future product updates can be pulled in.
+```
+
+Agents should follow [AI Agent Cloudflare Deployment](docs/agent-deploy-cloudflare.md).
+
+### Manual Deployment
+
+1. Fork the official repository:
+
+ ```text
+ https://github.com/msh01/edgeever
+ ```
+
+2. Clone your fork:
+
+ ```sh
+ git clone <your fork repository URL>
+ cd edgeever
+ ```
+
+3. Deploy with the helper commands:
+
+ ```sh
+ cp .env.local.example .env.local
+ bun install
+ EDGE_EVER_PASSWORD='<your password>' bun run deploy:setup
+ bun run deploy:doctor
+ bun run deploy
+ ```
+
+If you prefer creating Cloudflare resources manually:
+
+```sh
+cp .env.local.example .env.local
+bun install
+bunx wrangler d1 create edgeever
+bunx wrangler r2 bucket create edgeever-resources
+bun run auth:hash -- <your password>
+bun run deploy
+```
+
+Put the returned D1 `database_id` and password hash into your local `.env.local`.
+
+## Updating
+
+If you deployed from a fork:
+
+1. Open your EdgeEver fork on GitHub.
+2. Click **Sync fork** to pull the latest official code.
+3. Redeploy locally:
+
+ ```sh
+ git pull
+ bun install
+ bun run deploy:doctor
+ bun run deploy
+ ```
+
+Syncing the fork only updates your GitHub repository. You still need to redeploy for the Cloudflare instance to change.
+
+## Features
+
+- Nearly zero-cost personal hosting on Cloudflare D1 + R2 free quotas.
+- Open data: notes are stored in Cloudflare D1, based on standard SQLite, and can be read through REST API, MCP, and CLI.
+- AI Agent friendly: built-in MCP support lets tools such as Codex, Claude Code, and Antigravity read and organize notes with authorization.
+- Desktop and mobile support, including browser access and PWA installation.
+- Three-pane layout: notebook tree, note list, and main editor.
+- Unlimited nested notebooks.
+- Rich text editing.
+- Local browser-side image compression before upload, often reducing screenshots and large photos by about 50%-90%.
+- Batch note merging.
+- Batch note moving, notebook drag sorting, and hierarchy editing.
+- Offline drafts and local sync queue for existing notes.
+- Single-user login with PBKDF2-SHA256 password hashing.
+
+## PWA Installation
+
+EdgeEver can be installed as a PWA on desktop or mobile home screens. On desktop, open the site in Chrome or Edge and use the install icon in the address bar. On Android, open it in Chrome, use the three-dot menu, and choose **Add to Home screen** or **Install**. Avoid installing from embedded browsers such as WeChat.
+
+## Tech Stack
+
+- Bun workspace monorepo with Web, API, official site, and shared type package.
+- Official site: Astro static site in `apps/site`, deployable to Cloudflare Pages.
+- Frontend: Vite, React, React Router, TanStack Query, Tailwind CSS, shadcn/ui, and Radix UI.
+- Editor: TipTap / ProseMirror with Markdown support; PWA uses vite-plugin-pwa, Workbox, and Dexie.
+- Backend: Cloudflare Workers, Hono, Zod, D1, and R2, with REST API, OpenAPI, and Remote MCP.
+
+## Quick Start
+
+Install dependencies:
+
+```sh
+bun install
+```
+
+Apply local D1 migrations:
+
+```sh
+bun run db:migrate:local
+```
+
+Start local development:
+
+```sh
+bun run dev
+```
+
+Checks:
+
+```sh
+bun run typecheck
+bun run build
+```
+
+## Project Structure
+
+```text
+apps/web Vite + React frontend, PWA, offline drafts, and sync queue
+apps/api Cloudflare Worker + Hono API, OpenAPI, MCP endpoint
+apps/site Astro official website, deployable independently
+packages/shared Shared types, Zod schemas, TipTap / Markdown conversion
+scripts Wrangler wrapper, password hash, CLI, MCP stdio bridge, Evernote ENEX import
+migrations D1 database migrations
+docs OpenAPI schema, migration guides, and deployment docs
+wrangler.toml Cloudflare Workers, Assets, D1, R2 configuration
+```
+
+## Content Formats
+
+EdgeEver stores note content in three forms:
+
+```text
+content_json TipTap/ProseMirror document, the editor source of truth
+content_markdown API, Agent, import, and export format
+content_text Search, summary, and indexing text
+```
+
+## API
+
+OpenAPI schema:
+
+```text
+https://your-domain/api/openapi.json
+```
+
+Repository file: [docs/openapi.json](docs/openapi.json).
+
+## MCP
+
+Create an API token in **Profile** -> **MCP settings**, then copy either the token or full MCP configuration into your AI Agent so it can install the MCP server and read or organize notes with permission.
+
+## Image Compression
+
+Image compression happens in the Web client before upload and is controlled by the **Compress note images** setting. When enabled, PNG, JPEG, WebP, and AVIF files are converted to WebP when beneficial, with the longest edge limited to `2560px`. If compression does not reduce size, the original file is kept.
+
+EdgeEver avoids Worker-side image processing to reduce compute and image-processing quota usage. REST API and MCP upload paths store the file content provided by the client without additional server-side compression.
+
+## Community and Feedback
+
+- Bugs, feature requests, and deployment issues: [GitHub Issues](https://github.com/msh01/edgeever/issues)
+- WeChat: `m1245207870` (please mention EdgeEver)
diff --git a/README.md b/README.md
index 42b41434..efe900f8 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# EdgeEver
+[简体中文](README.md) | [English](README.en-US.md)
+
> **EdgeEver: A self-hosted, Cloudflare-native Evernote alternative.**
>
> **EdgeEver:基于 Cloudflare 全家桶自托管的免费开源『印象笔记』。**
diff --git a/apps/site/src/components/agent-install-tabs.astro b/apps/site/src/components/agent-install-tabs.astro
index c1511cb8..5ff70acf 100644
--- a/apps/site/src/components/agent-install-tabs.astro
+++ b/apps/site/src/components/agent-install-tabs.astro
@@ -1,8 +1,66 @@
---
import { Icon } from "astro-icon/components";
-const promptText =
- "请先 Fork EdgeEver 仓库:https://github.com/msh01/edgeever\n\nFork 完成后,请使用 Fork 后的仓库把 EdgeEver 安装部署到 Cloudflare 上,并为 Fork 仓库配置自动同步上游,以便后续获取最新产品特性。";
+const { locale = "zh-CN" } = Astro.props;
+const isEnglish = locale === "en-US";
+
+const copy = isEnglish
+ ? {
+ manual: "Manual install",
+ agent: "Install with AI Agent",
+ agentIntro:
+ "Copy the prompt below to your AI assistant (Claude Code, Codex, Cursor, Trae, and similar tools). It can complete the installation for you.",
+ promptLabel: "Prompt",
+ copyPrompt: "Copy prompt",
+ copying: "Copying...",
+ copied: "Copied",
+ copyFailed: "Copy failed",
+ manualIntro:
+ "Manual installation is best if you are comfortable with Cloudflare and the command line. Fork the repository first, then deploy from your own fork.",
+ step1: "Step 1",
+ step1Title: "Fork the official repository",
+ step2: "Step 2",
+ step2Title: "Clone your fork",
+ step3: "Step 3",
+ step3Title: "Deploy with the automated helper commands",
+ manualCloudflare: "Create Cloudflare resources manually",
+ manualHint: "Put the database_id returned by the D1 command and your password hash into your local .env.local file.",
+ promptText:
+ "Please fork the EdgeEver repository first: https://github.com/msh01/edgeever\n\nAfter the fork is ready, use the forked repository to install and deploy EdgeEver to Cloudflare, and configure automatic upstream sync for the fork so future product updates can be pulled in.",
+ forkUrl: "https://github.com/msh01/edgeever",
+ cloneCommand: "git clone <your fork repository URL>\ncd edgeever",
+ deployCommand:
+ "cp .env.local.example .env.local\nbun install\nEDGE_EVER_PASSWORD='<your password>' bun run deploy:setup\nbun run deploy:doctor\nbun run deploy",
+ manualCommand:
+ "cp .env.local.example .env.local\nbun install\nbunx wrangler d1 create edgeever\nbunx wrangler r2 bucket create edgeever-resources\nbun run auth:hash -- <your password>\nbun run deploy",
+ }
+ : {
+ manual: "手动安装",
+ agent: "通过 AI Agent 安装",
+ agentIntro: "将下方提示词复制给你的 AI 助手(Claude Code、Codex、Cursor、Trae 等),它会自动完成安装。",
+ promptLabel: "提示词",
+ copyPrompt: "复制提示词",
+ copying: "复制中...",
+ copied: "已复制",
+ copyFailed: "复制失败",
+ manualIntro: "手动安装适合熟悉 Cloudflare 与命令行的用户。先 Fork 仓库,再从你自己的 Fork 仓库部署。",
+ step1: "第一步",
+ step1Title: "Fork 官方仓库",
+ step2: "第二步",
+ step2Title: "Clone 你的 Fork 仓库",
+ step3: "第三步",
+ step3Title: "使用自动化辅助命令部署",
+ manualCloudflare: "手动创建 Cloudflare 资源",
+ manualHint: "把 D1 创建命令返回的 database_id 和密码 hash 填入本机 .env.local。",
+ promptText:
+ "请先 Fork EdgeEver 仓库:https://github.com/msh01/edgeever\n\nFork 完成后,请使用 Fork 后的仓库把 EdgeEver 安装部署到 Cloudflare 上,并为 Fork 仓库配置自动同步上游,以便后续获取最新产品特性。",
+ forkUrl: "https://github.com/msh01/edgeever",
+ cloneCommand: "git clone <你的 Fork 仓库 URL>\ncd edgeever",
+ deployCommand:
+ "cp .env.local.example .env.local\nbun install\nEDGE_EVER_PASSWORD='<你的密码>' bun run deploy:setup\nbun run deploy:doctor\nbun run deploy",
+ manualCommand:
+ "cp .env.local.example .env.local\nbun install\nbunx wrangler d1 create edgeever\nbunx wrangler r2 bucket create edgeever-resources\nbun run auth:hash -- <你的密码>\nbun run deploy",
+ };
---
<section class="not-prose relative left-1/2 my-10 w-[min(92vw,960px)] -translate-x-1/2" data-agent-install-tabs>
@@ -12,80 +70,74 @@ const promptText =
type="button"
data-tab-target="manual"
aria-selected="false">
- 手动安装
+ {copy.manual}
</button>
<button
class="agent-install-tab active px-2 pb-4 text-brand relative transition"
type="button"
data-tab-target="agent"
aria-selected="true">
- 通过 AI Agent 安装
+ {copy.agent}
</button>
</div>
<div class="mt-8 overflow-hidden rounded-[28px] bg-slate-100 px-6 py-8 sm:px-10 md:px-14">
<div class="agent-install-panel" data-tab-panel="agent">
<p class="mx-auto mb-8 max-w-3xl text-center text-lg leading-9 text-slate-600">
- 将下方提示词复制给你的 AI 助手(Claude Code、Codex、Cursor、Trae 等),它会自动完成安装。
+ {copy.agentIntro}
</p>
<div class="mx-auto max-w-3xl rounded-2xl bg-white p-6 shadow-sm">
- <p class="text-sm font-medium text-slate-400">提示词</p>
- <pre class="mt-4 whitespace-pre-wrap break-words font-mono text-base leading-8 text-slate-900">{promptText}</pre>
+ <p class="text-sm font-medium text-slate-400">{copy.promptLabel}</p>
+ <pre class="mt-4 whitespace-pre-wrap break-words font-mono text-base leading-8 text-slate-900">{copy.promptText}</pre>
</div>
<div class="mt-8 flex justify-center">
<button
class="agent-install-copy inline-flex items-center gap-2 rounded-full bg-brand px-8 py-3 text-base font-semibold text-white shadow-[0_14px_30px_-18px_rgb(var(--edgeever-brand-rgb)/0.85)] transition hover:-translate-y-0.5 hover:bg-brand-hover"
type="button"
- data-copy-text={promptText}>
+ data-copy-text={copy.promptText}
+ data-copy-default={copy.copyPrompt}
+ data-copy-copying={copy.copying}
+ data-copy-copied={copy.copied}
+ data-copy-failed={copy.copyFailed}>
<Icon class="h-5 w-5" name="bx:bx-copy" />
- <span data-copy-label>复制提示词</span>
+ <span data-copy-label>{copy.copyPrompt}</span>
</button>
</div>
</div>
<div class="agent-install-panel hidden" data-tab-panel="manual">
<p class="mx-auto max-w-3xl text-center text-lg leading-9 text-slate-600">
- 手动安装适合熟悉 Cloudflare 与命令行的用户。先 Fork 仓库,再从你自己的 Fork 仓库部署。
+ {copy.manualIntro}
</p>
<div class="mx-auto mt-8 grid max-w-3xl gap-4">
<div class="rounded-2xl bg-white p-6 shadow-sm">
- <p class="text-sm font-semibold text-brand-text">第一步</p>
- <h3 class="mt-2 text-xl font-bold text-slate-900">Fork 官方仓库</h3>
- <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">https://github.com/msh01/edgeever</pre>
+ <p class="text-sm font-semibold text-brand-text">{copy.step1}</p>
+ <h3 class="mt-2 text-xl font-bold text-slate-900">{copy.step1Title}</h3>
+ <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">{copy.forkUrl}</pre>
</div>
<div class="rounded-2xl bg-white p-6 shadow-sm">
- <p class="text-sm font-semibold text-brand-text">第二步</p>
- <h3 class="mt-2 text-xl font-bold text-slate-900">Clone 你的 Fork 仓库</h3>
- <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">git clone &lt;你的 Fork 仓库 URL&gt;
-cd edgeever</pre>
+ <p class="text-sm font-semibold text-brand-text">{copy.step2}</p>
+ <h3 class="mt-2 text-xl font-bold text-slate-900">{copy.step2Title}</h3>
+ <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">{copy.cloneCommand}</pre>
</div>
<div class="rounded-2xl bg-white p-6 shadow-sm">
- <p class="text-sm font-semibold text-brand-text">第三步</p>
- <h3 class="mt-2 text-xl font-bold text-slate-900">使用自动化辅助命令部署</h3>
- <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">cp .env.local.example .env.local
-bun install
-EDGE_EVER_PASSWORD='&lt;你的密码&gt;' bun run deploy:setup
-bun run deploy:doctor
-bun run deploy</pre>
+ <p class="text-sm font-semibold text-brand-text">{copy.step3}</p>
+ <h3 class="mt-2 text-xl font-bold text-slate-900">{copy.step3Title}</h3>
+ <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">{copy.deployCommand}</pre>
</div>
<details class="rounded-2xl bg-white p-6 shadow-sm">
<summary class="cursor-pointer text-base font-semibold text-slate-900">
- 手动创建 Cloudflare 资源
+ {copy.manualCloudflare}
</summary>
- <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">cp .env.local.example .env.local
-bun install
-bunx wrangler d1 create edgeever
-bunx wrangler r2 bucket create edgeever-resources
-bun run auth:hash -- &lt;你的密码&gt;
-bun run deploy</pre>
+ <pre class="mt-4 whitespace-pre-wrap rounded-xl bg-slate-50 p-4 font-mono text-sm leading-7 text-slate-800">{copy.manualCommand}</pre>
<p class="mt-4 text-sm leading-6 text-slate-500">
- 把 D1 创建命令返回的 database_id 和密码 hash 填入本机 .env.local。
+ {copy.manualHint}
</p>
</details>
</div>
@@ -149,16 +201,21 @@ bun run deploy</pre>
const text = button.getAttribute("data-copy-text") || "";
const label = button.querySelector("[data-copy-label]");
- if (label) label.textContent = "复制中...";
+ const defaultLabel = button.getAttribute("data-copy-default") || "Copy";
+ const copyingLabel = button.getAttribute("data-copy-copying") || "Copying...";
+ const copiedLabel = button.getAttribute("data-copy-copied") || "Copied";
+ const failedLabel = button.getAttribute("data-copy-failed") || "Copy failed";
+
+ if (label) label.textContent = copyingLabel;
try {
await copyTextToClipboard(text);
- if (label) label.textContent = "已复制";
+ if (label) label.textContent = copiedLabel;
window.setTimeout(() => {
- if (label) label.textContent = "复制提示词";
+ if (label) label.textContent = defaultLabel;
}, 1600);
} catch {
- if (label) label.textContent = "复制失败";
+ if (label) label.textContent = failedLabel;
}
});
});
diff --git a/apps/site/src/components/features.astro b/apps/site/src/components/features.astro
index e012741c..045bc198 100644
--- a/apps/site/src/components/features.astro
+++ b/apps/site/src/components/features.astro
@@ -1,68 +1,33 @@
---
import { Icon } from "astro-icon/components";
+import { getSiteLocale, siteCopy } from "@/i18n";
-const features = [
+const locale = getSiteLocale(Astro.url.pathname);
+const featureCopy = siteCopy[locale].features;
+const featureArt = [
{
- title: "海量存储,永久免费托管。",
- summary:
- "基于 Cloudflare D1 与 R2 提供的免费额度,个人笔记产生的数据量几乎永远用不完。",
icon: "bx:bx-cloud",
accent: "storage",
- points: [
- "免费额度对个人笔记足够宽裕:短笔记可达 10 万条量级,200KB 图片约可存放 5 万张。",
- "图片上传前在浏览器本地压缩,常见截图和照片通常减少 50%-90% 体积。",
- "数据和资源分别落在 D1 与 R2,部署后由你自己的 Cloudflare 账号承载。",
- ],
},
{
- title: "AI Agent 原生连接",
- summary:
- "内置 REST API、OpenAPI schema 与 Remote MCP endpoint,让 AI 助手安全地读取、创建和整理笔记。",
icon: "bx:bxs-bot",
accent: "agent",
- points: [
- "在应用内生成 MCP Token,就能把 EdgeEver 接入 Codex、Claude Code、Antigravity 等工具。",
- "适合做灵感归纳、自动打标签、知识图谱整理和跨笔记检索。",
- "API 与 Agent 能力围绕你的私有实例工作,不依赖封闭笔记平台。",
- ],
},
{
- title: "经典三栏,熟悉但更轻快",
- summary:
- "保留印象笔记式的笔记本树、笔记列表和主编辑区,减少迁移后的学习成本。",
icon: "bx:bx-layout",
accent: "workspace",
- points: [
- "支持无限级嵌套笔记本,适合长期沉淀的大型知识库。",
- "笔记本可以拖拽排序和调整层级,笔记支持多选移动与多选合并。",
- "基于 TipTap 的富文本编辑器,兼顾流畅写作与结构化内容保存。",
- ],
},
{
- title: "数据开放,迁移和导出不被绑架",
- summary:
- "笔记内容以结构化 JSON、Markdown 与纯文本多形态保存,便于编辑器、API、搜索和 Agent 分别使用。",
icon: "bx:bx-transfer",
accent: "open",
- points: [
- "内容存放在基于标准 SQLite 的 Cloudflare D1 中,可通过 API、MCP 或 CLI 按需读取。",
- "提供印象笔记 ENEX 导入脚本,保留创建/修改时间与嵌套笔记本层级。",
- "Markdown 面向导入导出和 Agent 使用,降低未来再次迁移的成本。",
- ],
},
{
- title: "多端随手记录,同步几乎无感",
- summary:
- "电脑、手机、平板都能直接打开使用,记录和同步尽量贴近本地应用的顺滑体验。",
icon: "bx:bx-shield-quarter",
accent: "secure",
- points: [
- "支持 PC 与移动端网页访问,也可以安装成 PWA,随手打开就能记。",
- "已有笔记支持离线编辑草稿和本地同步队列,弱网时也能先写后同步。",
- "单用户登录、PBKDF2-SHA256 密码 hash 与独立 API Token,安全能力放在顺手体验背后。",
- ],
},
];
+
+const features = featureCopy.items.map((item, index) => ({ ...item, ...featureArt[index] }));
---
<section class="mt-8 md:mt-12 relative overflow-hidden" aria-labelledby="features">
@@ -71,7 +36,7 @@ const features = [
<div class="max-w-3xl mb-14 text-center mx-auto">
<h2 class="text-4xl lg:text-5xl font-bold text-slate-900" id="features">
- 重新定义个人笔记体验
+ {featureCopy.heading}
</h2>
</div>
diff --git a/apps/site/src/components/hero.astro b/apps/site/src/components/hero.astro
index b884a8c6..b172c8f9 100644
--- a/apps/site/src/components/hero.astro
+++ b/apps/site/src/components/hero.astro
@@ -4,8 +4,10 @@ import heroProductImage from "@/assets/edgeever-hero-product.png";
import Link from "@/components/ui/link.astro";
import { Icon } from "astro-icon/components";
import { Meteors } from "@/components/magicui/meteors";
+import { getSiteLocale, siteCopy } from "@/i18n";
-const heroSlogan = "基于 Cloudflare 全家桶自托管的免费开源『印象笔记』";
+const locale = getSiteLocale(Astro.url.pathname);
+const copy = siteCopy[locale].hero;
---
<main class="relative grid gap-8 lg:grid-cols-[minmax(0,0.95fr)_minmax(420px,1.05fr)] place-items-center pt-8 pb-8 md:pt-10 md:pb-8 overflow-hidden">
@@ -19,7 +21,7 @@ const heroSlogan = "基于 Cloudflare 全家桶自托管的免费开源『印象
<div class="md:order-1 relative z-10 w-full">
<h1 class="text-4xl md:text-5xl xl:text-6xl font-bold text-slate-900 leading-tight">
<span class="text-gradient">EdgeEver</span>
- <span class="hero-slogan block mt-4 max-w-xl text-xl md:text-2xl font-medium leading-relaxed text-slate-700">{heroSlogan}</span>
+ <span class="hero-slogan block mt-4 max-w-xl text-xl md:text-2xl font-medium leading-relaxed text-slate-700">{copy.slogan}</span>
</h1>
<div class="mt-8 flex flex-col sm:flex-row gap-4">
@@ -29,7 +31,7 @@ const heroSlogan = "基于 Cloudflare 全家桶自托管的免费开源『印象
class="group flex gap-2 items-center justify-center text-white bg-brand border-transparent shadow-[0_12px_30px_-18px_rgb(var(--edgeever-brand-rgb)/0.8)] hover:bg-brand-hover hover:shadow-brand/40 transition-all duration-300 hover:-translate-y-1 rounded-xl"
rel="noopener">
<Icon class="w-5 h-5" name="bx:bx-show" />
- 在线演示
+ {copy.demo}
</Link>
<Link
size="lg"
@@ -47,7 +49,7 @@ const heroSlogan = "基于 Cloudflare 全家桶自托管的免费开源『印象
class="flex gap-2 items-center justify-center px-6 py-3 bg-white/50 backdrop-blur-sm border border-slate-200 hover:border-slate-300 rounded-xl text-slate-600 hover:text-brand-text transition-all text-sm font-medium hover:-translate-y-0.5"
>
<Icon class="w-5 h-5" name="bx:bxs-bot" />
- 通过AI Agent安装
+ {copy.agentInstall}
</a>
</div>
</div>
@@ -57,7 +59,7 @@ const heroSlogan = "基于 Cloudflare 全家桶自托管的免费开源『印象
<div class="absolute -inset-0.5 bg-gradient-to-tr from-brand-border/30 to-brand/10 rounded-2xl blur opacity-50"></div>
<Picture
src={heroProductImage}
- alt="EdgeEver product preview"
+ alt={copy.imageAlt}
widths={[480, 720, 960, 1200]}
sizes="(max-width: 1024px) 100vw, 640px"
loading="eager"
diff --git a/apps/site/src/components/magicui/border-beam.tsx b/apps/site/src/components/magicui/border-beam.tsx
index 01cc2e1a..7586d0d3 100644
--- a/apps/site/src/components/magicui/border-beam.tsx
+++ b/apps/site/src/components/magicui/border-beam.tsx
@@ -1,4 +1,4 @@
-import { cn } from "@/utils/cn";
+import { cn } from "../../utils/cn";
interface BorderBeamProps {
className?: string;
diff --git a/apps/site/src/components/magicui/magic-card.tsx b/apps/site/src/components/magicui/magic-card.tsx
index 5a9828c3..42fe2f25 100644
--- a/apps/site/src/components/magicui/magic-card.tsx
+++ b/apps/site/src/components/magicui/magic-card.tsx
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect } from "react";
import { motion, useMotionTemplate, useMotionValue } from "framer-motion";
-import { cn } from "@/utils/cn";
+import { cn } from "../../utils/cn";
export interface MagicCardProps extends React.HTMLAttributes<HTMLDivElement> {
gradientSize?: number;
diff --git a/apps/site/src/components/magicui/marquee.tsx b/apps/site/src/components/magicui/marquee.tsx
index 73bd758d..cb12c031 100644
--- a/apps/site/src/components/magicui/marquee.tsx
+++ b/apps/site/src/components/magicui/marquee.tsx
@@ -1,4 +1,4 @@
-import { cn } from "@/utils/cn";
+import { cn } from "../../utils/cn";
interface MarqueeProps {
className?: string;
diff --git a/apps/site/src/components/magicui/meteors.tsx b/apps/site/src/components/magicui/meteors.tsx
index ad69573f..aab57a43 100644
--- a/apps/site/src/components/magicui/meteors.tsx
+++ b/apps/site/src/components/magicui/meteors.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { cn } from "@/utils/cn";
+import { cn } from "../../utils/cn";
interface MeteorsProps {
number?: number;
diff --git a/apps/site/src/components/navbar/navbar.astro b/apps/site/src/components/navbar/navbar.astro
index 9dba8914..e325a16e 100644
--- a/apps/site/src/components/navbar/navbar.astro
+++ b/apps/site/src/components/navbar/navbar.astro
@@ -3,23 +3,28 @@ import Container from "@/components/container.astro";
import Link from "@/components/ui/link.astro";
import Dropdown from "./dropdown.astro";
import { Astronav, MenuItems, MenuIcon } from "astro-navbar";
+import { getLocalizedPath, getSiteLocale, siteCopy } from "@/i18n";
+const locale = getSiteLocale(Astro.url.pathname);
+const copy = siteCopy[locale].nav;
+const alternateLocale = locale === "zh-CN" ? "en-US" : "zh-CN";
+const alternatePath = getLocalizedPath(alternateLocale, Astro.url.pathname);
const menuitems = [
{
- title: "功能特性",
- path: "/#features",
+ title: copy.features,
+ path: `${getLocalizedPath(locale, "/")}#features`,
},
{
- title: "博客",
- path: "/blog",
+ title: copy.blog,
+ path: getLocalizedPath(locale, "/blog"),
},
{
- title: "关于项目",
- path: "/about",
+ title: copy.about,
+ path: getLocalizedPath(locale, "/about"),
},
{
- title: "联系我们",
- path: "/contact",
+ title: copy.contact,
+ path: getLocalizedPath(locale, "/contact"),
},
];
---
@@ -28,7 +33,7 @@ const menuitems = [
<header class="flex flex-col lg:flex-row justify-between items-center my-5">
<Astronav>
<div class="flex w-full lg:w-auto items-center justify-between">
- <a href="/" class="flex items-center gap-2 text-lg" aria-label="EdgeEver 首页"
+ <a href={getLocalizedPath(locale, "/")} class="flex items-center gap-2 text-lg" aria-label={copy.homeAria}
>
<span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[var(--edgeever-brand-logo-bg)]">
<svg class="h-6 w-6" viewBox="0 0 64 64" role="img" aria-hidden="true">
@@ -77,14 +82,16 @@ const menuitems = [
}
</ul>
<div class="lg:hidden flex items-center mt-3 gap-4">
- <Link href="https://demo.edgeever.org" target="_blank" style="muted" block size="md">在线演示</Link>
+ <Link href="https://demo.edgeever.org" target="_blank" style="muted" block size="md">{copy.demo}</Link>
<Link href="https://github.com/msh01/edgeever" target="_blank" size="md" block>GitHub</Link>
+ <a href={alternatePath} class="text-sm text-gray-600 hover:text-gray-900">{copy.languageLabel}</a>
</div>
</MenuItems>
</Astronav>
<div>
<div class="hidden lg:flex items-center gap-4">
- <a href="https://demo.edgeever.org" target="_blank" class="text-gray-600 hover:text-gray-900 transition">在线演示</a>
+ <a href="https://demo.edgeever.org" target="_blank" class="text-gray-600 hover:text-gray-900 transition">{copy.demo}</a>
+ <a href={alternatePath} class="text-gray-600 hover:text-gray-900 transition">{copy.languageLabel}</a>
<Link href="https://github.com/msh01/edgeever" target="_blank" size="md">GitHub</Link>
</div>
</div>
diff --git a/apps/site/src/content/blog_en/ai-agent-deploy-cloudflare.md b/apps/site/src/content/blog_en/ai-agent-deploy-cloudflare.md
new file mode 100644
index 00000000..11f721f0
--- /dev/null
+++ b/apps/site/src/content/blog_en/ai-agent-deploy-cloudflare.md
@@ -0,0 +1,13 @@
+---
+draft: false
+title: "Deploy EdgeEver to Cloudflare with one AI Agent prompt"
+snippet: "Give your EdgeEver fork URL to an AI Agent and deploy the project to Cloudflare with the repository deployment protocol."
+image: {
+ src: "/images/agent-deploy.jpg",
+ alt: "AI Agent deploying EdgeEver to Cloudflare"
+}
+publishDate: "2026-07-02 00:50"
+category: "Deployment"
+author: "EdgeEver Team"
+tags: [cloudflare, deploy, ai-agent, serverless]
+---
diff --git a/apps/site/src/content/blog_en/edgeever-major-update.md b/apps/site/src/content/blog_en/edgeever-major-update.md
new file mode 100644
index 00000000..61cf8c8a
--- /dev/null
+++ b/apps/site/src/content/blog_en/edgeever-major-update.md
@@ -0,0 +1,86 @@
+---
+draft: false
+title: "EdgeEver capability overview: Cloudflare self-hosting, Open API, and MCP"
+snippet: "A current product overview based on the EdgeEver README, docs, and implementation structure."
+image: {
+ src: "/images/major-update.jpg",
+ alt: "EdgeEver product capability overview"
+}
+publishDate: "2026-07-02 00:40"
+category: "Product"
+author: "EdgeEver Team"
+tags: [updates, pwa, mcp, editor]
+---
+
+This article reflects the capabilities that are already explicit in the core repository. EdgeEver is an open source, self-hosted, Cloudflare-native notes workspace. It keeps the familiar three-column experience from classic Evernote-style tools while adding a REST API, OpenAPI schema, and Remote MCP endpoint.
+
+The summary below is based on the README, documentation, and implementation structure in the core `edgeever` repository.
+
+---
+
+### 1. Classic three-column notes workspace
+
+EdgeEver keeps a familiar workspace layout:
+
+- Notebook tree
+- Note list
+- Main editor
+
+It supports deeply nested notebooks, drag-and-drop notebook sorting and hierarchy changes, moving multiple notes, merging multiple notes, and rich text editing.
+
+### 2. Open content model
+
+EdgeEver stores content in three forms:
+
+```text
+content_json TipTap/ProseMirror document, the editor's source of truth
+content_markdown API, Agent, import, and export format
+content_text Search, excerpt, and indexing format
+```
+
+This lets the web editor, REST API, MCP, import/export tooling, and search index each use the most suitable representation.
+
+### 3. Cloudflare-native self-hosting
+
+The current deployment target is a Cloudflare Worker:
+
+- `/api/*` is handled by the Hono API
+- Frontend static assets are served by Workers Assets
+- D1 stores notebook, memo, memo content, and resource metadata
+- R2 stores images and attachment objects
+
+The core README gives a personal-use estimate of roughly 100,000 short notes or about 50,000 200 KB images. Actual usage and cost still depend on your Cloudflare account plan and Cloudflare's current pricing.
+
+### 4. Browser-side image compression and PWA
+
+Before upload, the web app can compress PNG, JPEG, WebP, and AVIF images locally in the browser, convert them to WebP, and limit the longest side to `2560px`. If the compressed file is not smaller than the original, EdgeEver keeps the original file. The server does not perform Cloudflare Images-style processing.
+
+EdgeEver also supports PWA installation. The frontend uses Workbox and Dexie for offline drafts and a local sync queue.
+
+### 5. REST API, OpenAPI, and MCP
+
+EdgeEver provides:
+
+- REST API
+- `/api/openapi.json`
+- Remote MCP endpoint
+- CLI and MCP stdio bridge scripts
+
+After creating an API token in the MCP settings card in the EdgeEver profile area, you can copy the token or the full MCP configuration and give it to an AI Agent so it can read and organize your notes.
+
+### 6. Updating to the latest version
+
+If you deployed from a fork:
+
+1. Open your own EdgeEver fork on GitHub.
+2. Click **Sync fork** on GitHub to sync the latest code from upstream.
+3. Return to your local project and redeploy:
+
+```sh
+git pull
+bun install
+bun run deploy:doctor
+bun run deploy
+```
+
+Syncing the fork only updates the code in GitHub. It does not automatically update the instance already deployed on Cloudflare. You still need to run the deployment command again.
diff --git a/apps/site/src/content/blog_en/evernote-migration-guide.md b/apps/site/src/content/blog_en/evernote-migration-guide.md
new file mode 100644
index 00000000..3ffc32f2
--- /dev/null
+++ b/apps/site/src/content/blog_en/evernote-migration-guide.md
@@ -0,0 +1,58 @@
+---
+draft: false
+title: "Minimal Evernote migration guide for EdgeEver"
+snippet: "Migrate Evernote data into a self-hosted EdgeEver instance with EdgeEver MCP, evernote-backup, and the ENEX import script."
+image: {
+ src: "/images/evernote-migration.jpg",
+ alt: "Migrating from Evernote to EdgeEver"
+}
+publishDate: "2026-07-02 01:00"
+category: "Migration"
+author: "EdgeEver Team"
+tags: [evernote, migration, self-hosted, mcp]
+---
+
+We recommend using an AI coding assistant, such as Antigravity, Claude Code, Cursor, or a similar tool, to automate the migration. The migration guide in the core repository notes that the approach includes streaming memory optimization and empty-text preprocessing, supports very large note libraries, and preserves created/updated timestamps plus nested notebook hierarchy.
+
+---
+
+### Step 1: Configure and install the EdgeEver MCP service
+
+1. Open the **Settings** area from the lower-left corner of the web app.
+2. Generate a token from the **API & MCP authorization** card, then click **Copy full MCP config**.
+3. Send the copied JSON configuration directly to your AI coding assistant and ask it to add the MCP server to your current AI client:
+
+```text
+You are my AI coding assistant. This is my EdgeEver MCP service configuration JSON. Please configure this MCP service directly in the MCP server configuration file for the AI editor/client I am currently using, such as Claude Code, Cursor, Cline, or a similar tool:
+
+<paste the JSON configuration here>
+```
+
+---
+
+### Step 2: Let the AI assistant export and import your notes
+
+After the assistant has configured MCP, copy the prompt below and send it to the assistant so it can export your Evernote data and import it into EdgeEver:
+
+```text
+You are my AI coding assistant. Please migrate my local Evernote data into my currently deployed EdgeEver instance:
+1. Check for and install the backup tool with `pipx install evernote-backup`.
+2. Ask me for my Evernote username and password, initialize the database with the China backend if needed, sync the data, and export it to `./evernote-export`.
+3. Download the latest migration script from GitHub: `https://raw.githubusercontent.com/msh01/edgeever/main/scripts/import-evernote-enex-via-mcp.mjs`.
+4. Install the local image compression and XML parsing dependencies required by the script: `sharp` and `fast-xml-parser`.
+5. Use the previously configured URL and token to run the script and complete the migration. The script will automatically convert images to WebP:
+ - Full migration: `bun import-evernote-enex-via-mcp.mjs --input "./evernote-export" --yes`
+ - To import only specific notebooks, append `--include "Notebook A,Notebook B"`.
+
+Tell me what information you need, such as account credentials, and then run the steps concurrently where possible.
+```
+
+> Manual fallback: if you do not use an AI assistant, open the [EdgeEver GitHub repository](https://github.com/msh01/edgeever), download `scripts/import-evernote-enex-via-mcp.mjs`, and follow the instructions in the script header.
+
+---
+
+### Step 3: Verify the import in the web app
+
+1. After import completes, return to the EdgeEver web app and refresh the page.
+2. Check the left sidebar and confirm that the original Evernote notebook stack hierarchy has been restored.
+3. Open a few image-heavy notes and confirm that the images load clearly in the editor.
diff --git a/apps/site/src/content/config.ts b/apps/site/src/content/config.ts
index c4143af1..e027173b 100644
--- a/apps/site/src/content/config.ts
+++ b/apps/site/src/content/config.ts
@@ -22,4 +22,5 @@ const blogCollection = defineCollection({
// This key should match your collection directory name in "src/content"
export const collections = {
'blog': blogCollection,
+ 'blog_en': blogCollection,
};
diff --git a/apps/site/src/i18n.ts b/apps/site/src/i18n.ts
new file mode 100644
index 00000000..79f96c86
--- /dev/null
+++ b/apps/site/src/i18n.ts
@@ -0,0 +1,170 @@
+export type SiteLocale = "zh-CN" | "en-US";
+
+export const defaultSiteLocale: SiteLocale = "zh-CN";
+
+export const getSiteLocale = (pathname: string): SiteLocale => (pathname === "/en" || pathname.startsWith("/en/") ? "en-US" : "zh-CN");
+
+export const getLocalizedPath = (locale: SiteLocale, path: string) => {
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
+
+ if (locale === "zh-CN") {
+ return normalizedPath === "/en" ? "/" : normalizedPath.replace(/^\/en(?=\/|$)/, "") || "/";
+ }
+
+ if (normalizedPath === "/") {
+ return "/en/";
+ }
+
+ return normalizedPath.startsWith("/en/") ? normalizedPath : `/en${normalizedPath}`;
+};
+
+export const siteCopy = {
+ "zh-CN": {
+ layout: {
+ defaultDescription:
+ "EdgeEver 是一个开源、自托管、Cloudflare-native 的现代笔记工作区。保留经典印象笔记的三栏体验,支持富文本、无限嵌套,原生支持 MCP 对 AI Agent 极度友好,个人托管接近零成本。",
+ defaultTitle: "EdgeEver - 基于 Cloudflare 全家桶自托管的免费开源『印象笔记』",
+ imageAlt: "EdgeEver 笔记应用截图",
+ ogLocale: "zh_CN",
+ },
+ nav: {
+ homeAria: "EdgeEver 首页",
+ features: "功能特性",
+ blog: "博客",
+ about: "关于项目",
+ contact: "联系我们",
+ demo: "在线演示",
+ languageLabel: "English",
+ },
+ hero: {
+ slogan: "基于 Cloudflare 全家桶自托管的免费开源『印象笔记』",
+ demo: "在线演示",
+ agentInstall: "通过AI Agent安装",
+ imageAlt: "EdgeEver product preview",
+ },
+ features: {
+ heading: "重新定义个人笔记体验",
+ items: [
+ {
+ title: "海量存储,永久免费托管。",
+ summary: "基于 Cloudflare D1 与 R2 提供的免费额度,个人笔记产生的数据量几乎永远用不完。",
+ points: [
+ "免费额度对个人笔记足够宽裕:短笔记可达 10 万条量级,200KB 图片约可存放 5 万张。",
+ "图片上传前在浏览器本地压缩,常见截图和照片通常减少 50%-90% 体积。",
+ "数据和资源分别落在 D1 与 R2,部署后由你自己的 Cloudflare 账号承载。",
+ ],
+ },
+ {
+ title: "AI Agent 原生连接",
+ summary: "内置 REST API、OpenAPI schema 与 Remote MCP endpoint,让 AI 助手安全地读取、创建和整理笔记。",
+ points: [
+ "在应用内生成 MCP Token,就能把 EdgeEver 接入 Codex、Claude Code、Antigravity 等工具。",
+ "适合做灵感归纳、自动打标签、知识图谱整理和跨笔记检索。",
+ "API 与 Agent 能力围绕你的私有实例工作,不依赖封闭笔记平台。",
+ ],
+ },
+ {
+ title: "经典三栏,熟悉但更轻快",
+ summary: "保留印象笔记式的笔记本树、笔记列表和主编辑区,减少迁移后的学习成本。",
+ points: [
+ "支持无限级嵌套笔记本,适合长期沉淀的大型知识库。",
+ "笔记本可以拖拽排序和调整层级,笔记支持多选移动与多选合并。",
+ "基于 TipTap 的富文本编辑器,兼顾流畅写作与结构化内容保存。",
+ ],
+ },
+ {
+ title: "数据开放,迁移和导出不被绑架",
+ summary: "笔记内容以结构化 JSON、Markdown 与纯文本多形态保存,便于编辑器、API、搜索和 Agent 分别使用。",
+ points: [
+ "内容存放在基于标准 SQLite 的 Cloudflare D1 中,可通过 API、MCP 或 CLI 按需读取。",
+ "支持印象笔记数据导入能力,降低从旧笔记库迁移过来的成本。",
+ "Markdown 面向导入导出和 Agent 使用,降低未来再次迁移的成本。",
+ ],
+ },
+ {
+ title: "多端随手记录,同步几乎无感",
+ summary: "电脑、手机、平板都能直接打开使用,记录和同步尽量贴近本地应用的顺滑体验。",
+ points: [
+ "支持 PC 与移动端网页访问,也可以安装成 PWA,随手打开就能记。",
+ "已有笔记支持离线编辑草稿和本地同步队列,弱网时也能先写后同步。",
+ "单用户登录、PBKDF2-SHA256 密码 hash 与独立 API Token,安全能力放在顺手体验背后。",
+ ],
+ },
+ ],
+ },
+ },
+ "en-US": {
+ layout: {
+ defaultDescription:
+ "EdgeEver is an open-source, self-hosted, Cloudflare-native notes workspace with a classic three-pane workflow, rich text, nested notebooks, REST API, OpenAPI schema, and Remote MCP endpoint.",
+ defaultTitle: "EdgeEver - A self-hosted, Cloudflare-native Evernote alternative",
+ imageAlt: "EdgeEver notes app screenshot",
+ ogLocale: "en_US",
+ },
+ nav: {
+ homeAria: "EdgeEver home",
+ features: "Features",
+ blog: "Blog",
+ about: "About",
+ contact: "Contact",
+ demo: "Demo",
+ languageLabel: "简体中文",
+ },
+ hero: {
+ slogan: "A free, open-source Evernote alternative self-hosted on Cloudflare.",
+ demo: "Live demo",
+ agentInstall: "Install with AI Agent",
+ imageAlt: "EdgeEver product preview",
+ },
+ features: {
+ heading: "A personal notes workspace rebuilt for self-hosting",
+ items: [
+ {
+ title: "Generous storage, nearly free forever.",
+ summary: "Cloudflare D1 and R2 free quotas are roomy enough for a personal notes archive.",
+ points: [
+ "The free tier can cover roughly 100k short notes and about 50k 200KB images.",
+ "Images are compressed locally before upload, often reducing screenshots and photos by 50%-90%.",
+ "Your data and resources live in your own Cloudflare account after deployment.",
+ ],
+ },
+ {
+ title: "AI Agent native",
+ summary: "Built-in REST API, OpenAPI schema, and Remote MCP endpoint let AI assistants read, create, and organize notes safely.",
+ points: [
+ "Generate an MCP token in the app to connect EdgeEver with Codex, Claude Code, Antigravity, and similar tools.",
+ "Useful for idea summaries, automatic tagging, knowledge graph cleanup, and cross-note retrieval.",
+ "Agent workflows operate on your private instance instead of a closed notes platform.",
+ ],
+ },
+ {
+ title: "Classic three-pane workflow",
+ summary: "Notebook tree, note list, and editor stay familiar for Evernote-style migrations.",
+ points: [
+ "Unlimited nested notebooks support long-lived personal knowledge bases.",
+ "Drag notebooks to reorder or change hierarchy, and move or merge notes in batches.",
+ "A TipTap-based rich text editor keeps writing smooth while preserving structured content.",
+ ],
+ },
+ {
+ title: "Open data, easier migration",
+ summary: "Notes are stored as structured JSON, Markdown, and plain text for editors, APIs, search, and agents.",
+ points: [
+ "Content lives in Cloudflare D1, based on standard SQLite, and can be read via API, MCP, or CLI.",
+ "Evernote import support lowers the cost of moving from an existing notes library.",
+ "Markdown keeps import, export, and agent workflows portable.",
+ ],
+ },
+ {
+ title: "Works across desktop and mobile",
+ summary: "Use EdgeEver from desktop, phone, or tablet with a PWA-friendly experience.",
+ points: [
+ "Open it in the browser or install it as a PWA for quick capture.",
+ "Existing notes support offline drafts and a local sync queue for weak network conditions.",
+ "Single-user login, PBKDF2-SHA256 password hashing, and API tokens stay behind a simple UI.",
+ ],
+ },
+ ],
+ },
+ },
+} as const;
diff --git a/apps/site/src/layouts/BlogLayout.astro b/apps/site/src/layouts/BlogLayout.astro
index 56538a19..0b0b5279 100644
--- a/apps/site/src/layouts/BlogLayout.astro
+++ b/apps/site/src/layouts/BlogLayout.astro
@@ -6,6 +6,9 @@ import Layout from "./Layout.astro";
const { frontmatter } = Astro.props;
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
const imageUrl = new URL(frontmatter.image.src, Astro.site).toString();
+const isEnglish = Astro.url.pathname.startsWith("/en/");
+const blogHref = isEnglish ? "/en/blog" : "/blog";
+const backLabel = isEnglish ? "Back to blog" : "返回博客";
const articleJsonLd = {
"@context": "https://schema.org",
@@ -77,9 +80,9 @@ const articleJsonLd = {
</div>
<div class="text-center mt-8">
<a
- href="/blog"
+ href={blogHref}
class="bg-gray-100 px-5 py-3 rounded-md hover:bg-gray-200 transition"
- >返回博客</a
+ >{backLabel}</a
>
</div>
</Container>
diff --git a/apps/site/src/layouts/Layout.astro b/apps/site/src/layouts/Layout.astro
index 6748753e..3cec0e0b 100644
--- a/apps/site/src/layouts/Layout.astro
+++ b/apps/site/src/layouts/Layout.astro
@@ -2,6 +2,7 @@
import { SEO } from "astro-seo";
import Footer from "@/components/footer.astro";
import Navbar from "@/components/navbar/navbar.astro";
+import { getLocalizedPath, getSiteLocale, siteCopy } from "@/i18n";
import "@fontsource-variable/inter/index.css";
import "@fontsource-variable/bricolage-grotesque";
import "../styles/global.css";
@@ -22,15 +23,18 @@ export interface Props {
}
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
+const locale = getSiteLocale(Astro.url.pathname);
+const copy = siteCopy[locale].layout;
+const zhAlternateURL = new URL(getLocalizedPath("zh-CN", Astro.url.pathname), Astro.site).toString();
+const enAlternateURL = new URL(getLocalizedPath("en-US", Astro.url.pathname), Astro.site).toString();
-const defaultDescription =
- "EdgeEver 是一个开源、自托管、Cloudflare-native 的现代笔记工作区。保留经典印象笔记的三栏体验,支持富文本、无限嵌套,原生支持 MCP 对 AI Agent 极度友好,个人托管接近零成本。";
+const defaultDescription = copy.defaultDescription;
const {
title,
description = defaultDescription,
image = "/opengraph.jpg",
- imageAlt = "EdgeEver 笔记应用截图",
+ imageAlt = copy.imageAlt,
openGraphType = "website",
articlePublishedTime,
articleModifiedTime,
@@ -45,17 +49,20 @@ const resolvedImageWithDomain = new URL(image, Astro.site).toString();
const makeTitle = title
? title + " | " + "EdgeEver"
- : "EdgeEver - 基于 Cloudflare 全家桶自托管的免费开源『印象笔记』";
+ : copy.defaultTitle;
const faviconVersion = "edgeever-brand-20260703";
---
<!doctype html>
-<html lang="zh-CN">
+<html lang={locale}>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href={`/favicon.svg?v=${faviconVersion}`} />
+ <link rel="alternate" hreflang="zh-CN" href={zhAlternateURL} />
+ <link rel="alternate" hreflang="en-US" href={enAlternateURL} />
+ <link rel="alternate" hreflang="x-default" href={zhAlternateURL} />
<meta name="theme-color" content="#f8fafc" />
<meta name="generator" content={Astro.generator} />
@@ -83,7 +90,7 @@ const faviconVersion = "edgeever-brand-20260703";
},
optional: {
description,
- locale: "zh_CN",
+ locale: copy.ogLocale,
siteName: "EdgeEver",
},
image: {
diff --git a/apps/site/src/pages/en/about.astro b/apps/site/src/pages/en/about.astro
new file mode 100644
index 00000000..f4e5d89f
--- /dev/null
+++ b/apps/site/src/pages/en/about.astro
@@ -0,0 +1,86 @@
+---
+import Layout from "@/layouts/Layout.astro";
+import Container from "@/components/container.astro";
+import Sectionhead from "@/components/sectionhead.astro";
+import { Icon } from "astro-icon/components";
+---
+
+<Layout
+ title="About"
+ description="Learn about EdgeEver's Cloudflare-native self-hosted architecture, open APIs, and MCP support for AI Agents."
+>
+ <Container>
+ <Sectionhead>
+ <Fragment slot="title">About EdgeEver</Fragment>
+ <Fragment slot="desc">An open-source, self-hosted, Cloudflare-native notes workspace.</Fragment>
+ </Sectionhead>
+
+ <div class="mx-auto max-w-4xl mt-16 text-slate-700 leading-relaxed text-lg">
+ <div class="bg-slate-50 border border-slate-100 p-8 rounded-lg mb-12 shadow-sm">
+ <h2 class="font-bold text-3xl text-slate-900 flex items-center gap-2 mb-4">
+ <Icon class="text-brand w-7 h-7 shrink-0" name="bx:bxs-quote-left" />
+ Why EdgeEver?
+ </h2>
+ <p class="text-slate-600 text-lg leading-relaxed">
+ Many long-time Evernote users need a reliable, open, and responsive personal knowledge base. As commercial notes products become heavier and harder to leave, getting your notes back into open formats becomes unnecessarily painful.
+ </p>
+ <p class="mt-4 font-semibold text-brand-text">
+ EdgeEver keeps the familiar three-pane notes workflow while adding open data, REST API, MCP, and near-zero-cost self-hosted deployment.
+ </p>
+ </div>
+
+ <div class="grid md:grid-cols-2 gap-8 my-16">
+ <div class="bg-white border border-slate-100 p-8 rounded-lg glow-card hover-lift flex flex-col justify-between">
+ <div>
+ <div class="bg-brand-soft border border-brand-border/20 rounded-xl p-2 w-10 h-10 flex items-center justify-center mb-6">
+ <Icon class="text-brand-text w-5 h-5" name="bx:bxs-cloud" />
+ </div>
+ <h3 class="font-bold text-2xl text-slate-900 mb-3">Cloudflare-native architecture</h3>
+ <p class="text-slate-500 text-sm leading-relaxed mb-6">
+ EdgeEver runs as a Cloudflare Worker serving both API and frontend assets. D1 stores notes, R2 stores images and attachments, and the whole stack is friendly to personal self-hosting.
+ </p>
+ <ul class="space-y-2 text-sm text-slate-600">
+ <li class="flex items-center gap-2"><Icon class="text-brand w-4 h-4 shrink-0" name="bx:bx-check-circle" />D1 SQLite database for note data</li>
+ <li class="flex items-center gap-2"><Icon class="text-brand w-4 h-4 shrink-0" name="bx:bx-check-circle" />R2 object storage for files and images</li>
+ <li class="flex items-center gap-2"><Icon class="text-brand w-4 h-4 shrink-0" name="bx:bx-check-circle" />Workers, Hono, and Zod for the REST API</li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="bg-white border border-slate-100 p-8 rounded-lg glow-card hover-lift flex flex-col justify-between">
+ <div>
+ <div class="bg-brand-soft border border-brand-border/20 rounded-xl p-2 w-10 h-10 flex items-center justify-center mb-6">
+ <Icon class="text-brand-text w-5 h-5" name="bx:bxs-bot" />
+ </div>
+ <h3 class="font-bold text-2xl text-slate-900 mb-3">Open interfaces for Agents</h3>
+ <p class="text-slate-500 text-sm leading-relaxed mb-6">
+ EdgeEver exposes an OpenAPI schema and Remote MCP endpoint. After creating an API token, AI Agents can read, organize, and maintain notes within the authorized scope.
+ </p>
+ <ul class="space-y-2 text-sm text-slate-600">
+ <li class="flex items-center gap-2"><Icon class="text-brand w-4 h-4 shrink-0" name="bx:bx-check-circle" />Built-in Remote MCP endpoint</li>
+ <li class="flex items-center gap-2"><Icon class="text-brand w-4 h-4 shrink-0" name="bx:bx-check-circle" />Agents can read, classify, and organize notes through APIs</li>
+ <li class="flex items-center gap-2"><Icon class="text-brand w-4 h-4 shrink-0" name="bx:bx-check-circle" />The settings page provides MCP config copy actions</li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <div class="relative bg-slate-900 border border-slate-800 p-8 rounded-lg flex flex-col md:flex-row items-center justify-between gap-8 my-12 overflow-hidden shadow-xl">
+ <div class="relative z-10 max-w-lg">
+ <h3 class="font-bold text-white text-2xl">Start from a fork of the official repository</h3>
+ <p class="text-sm text-slate-400 mt-2 leading-relaxed">
+ Fork the official repository first. Later, use GitHub Sync fork to pull upstream updates, then redeploy with `bun install`, `bun run deploy:doctor`, and `bun run deploy`.
+ </p>
+ </div>
+ <a
+ href="https://github.com/msh01/edgeever"
+ target="_blank"
+ class="relative z-10 px-6 py-3 bg-white text-slate-900 rounded-xl text-center font-semibold hover:bg-slate-100 transition whitespace-nowrap shadow-lg hover:scale-[1.02]"
+ rel="noopener"
+ >
+ Open GitHub
+ </a>
+ </div>
+ </div>
+ </Container>
+</Layout>
diff --git a/apps/site/src/pages/en/blog.astro b/apps/site/src/pages/en/blog.astro
new file mode 100644
index 00000000..ca07fab3
--- /dev/null
+++ b/apps/site/src/pages/en/blog.astro
@@ -0,0 +1,57 @@
+---
+import { getCollection } from "astro:content";
+import Layout from "@/layouts/Layout.astro";
+import Container from "@/components/container.astro";
+import { getFormattedDate } from "@/utils/all";
+
+const entries = (await getCollection("blog_en", ({ data }) => !data.draft)).sort(
+ (a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime(),
+);
+
+const blogDescription =
+ "English EdgeEver notes about Cloudflare self-hosting, Evernote migration, product updates, and AI Agent workflows.";
+
+const blogUrl = new URL(Astro.url.pathname, Astro.site).toString();
+const blogJsonLd = {
+ "@context": "https://schema.org",
+ "@type": "CollectionPage",
+ name: "EdgeEver Blog",
+ url: blogUrl,
+ inLanguage: "en-US",
+ description: blogDescription,
+};
+---
+
+<Layout title="Blog" description={blogDescription} jsonLd={blogJsonLd}>
+ <Container>
+ <section class="mx-auto max-w-4xl py-16 md:py-24">
+ <p class="text-sm font-semibold text-brand-text">EdgeEver Blog</p>
+ <h1 class="mt-3 text-4xl font-bold tracking-tight text-slate-950 md:text-5xl">Blog</h1>
+
+ <div class="mt-10 grid gap-4">
+ {
+ entries.map((entry) => (
+ <a
+ href={`/en/blog/${entry.slug}`}
+ class="group rounded-2xl border border-slate-200 bg-white p-6 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-border hover:shadow-lg"
+ >
+ <div class="flex flex-wrap items-center gap-3 text-sm text-slate-500">
+ <span>{entry.data.category}</span>
+ <span>·</span>
+ <time datetime={entry.data.publishDate.toISOString()}>
+ {getFormattedDate(entry.data.publishDate)}
+ </time>
+ </div>
+ <h2 class="mt-3 text-2xl font-bold text-slate-900 transition group-hover:text-brand-text">
+ {entry.data.title}
+ </h2>
+ <p class="mt-3 text-base leading-7 text-slate-600">
+ {entry.data.snippet}
+ </p>
+ </a>
+ ))
+ }
+ </div>
+ </section>
+ </Container>
+</Layout>
diff --git a/apps/site/src/pages/en/blog/[slug].astro b/apps/site/src/pages/en/blog/[slug].astro
new file mode 100644
index 00000000..76716552
--- /dev/null
+++ b/apps/site/src/pages/en/blog/[slug].astro
@@ -0,0 +1,21 @@
+---
+import { getCollection, render } from "astro:content";
+import AgentInstallTabs from "@/components/agent-install-tabs.astro";
+import BlogLayout from "@/layouts/BlogLayout.astro";
+
+export async function getStaticPaths() {
+ const entries = await getCollection("blog_en", ({ data }) => !data.draft);
+ return entries.map((entry) => ({
+ params: { slug: entry.slug },
+ props: { entry },
+ }));
+}
+
+const { entry } = Astro.props;
+const { Content } = await render(entry);
+---
+
+<BlogLayout frontmatter={entry.data}>
+ {entry.slug === "ai-agent-deploy-cloudflare" && <AgentInstallTabs locale="en-US" />}
+ <Content />
+</BlogLayout>
diff --git a/apps/site/src/pages/en/contact.astro b/apps/site/src/pages/en/contact.astro
new file mode 100644
index 00000000..6eb68dfa
--- /dev/null
+++ b/apps/site/src/pages/en/contact.astro
@@ -0,0 +1,62 @@
+---
+import Container from "@/components/container.astro";
+import Sectionhead from "@/components/sectionhead.astro";
+import Layout from "@/layouts/Layout.astro";
+import { Icon } from "astro-icon/components";
+---
+
+<Layout
+ title="Contact"
+ description="EdgeEver contact and community links. Bugs, feature requests, and deployment issues are best tracked through GitHub Issues."
+>
+ <Container>
+ <Sectionhead>
+ <Fragment slot="title">Contact and Community</Fragment>
+ <Fragment slot="desc">Please use public channels for bugs, feature requests, and deployment issues so future users can find the full context.</Fragment>
+ </Sectionhead>
+
+ <div class="grid md:grid-cols-2 gap-12 mx-auto max-w-4xl mt-16 text-slate-700">
+ <div>
+ <h2 class="font-bold text-2xl text-gray-900">EdgeEver developer community</h2>
+ <p class="text-lg leading-relaxed text-slate-500 mt-4">
+ The core README recommends using GitHub Issues for bugs, feature requests, and deployment questions. This keeps solutions searchable and reusable for other self-hosters.
+ </p>
+ <div class="mt-6 space-y-4">
+ <div class="flex items-start space-x-3">
+ <Icon class="text-gray-600 w-6 h-6 shrink-0 mt-0.5" name="bx:bxl-github" />
+ <div>
+ <a href="https://github.com/msh01/edgeever/issues" target="_blank" class="font-semibold text-gray-900 hover:underline">
+ GitHub Issues
+ </a>
+ <p class="text-sm text-slate-500 mt-1">Best for software bugs, deployment problems, and concrete feature requests.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="bg-slate-50 p-8 rounded-lg border border-slate-100 flex flex-col justify-between">
+ <div>
+ <h2 class="font-bold text-xl text-gray-900">Other contact information</h2>
+ <p class="text-sm text-slate-500 mt-2">
+ For private communication, use the WeChat contact listed in the core README and mention EdgeEver when adding the contact.
+ </p>
+ <div class="mt-6 space-y-3">
+ <div class="flex items-center space-x-2.5">
+ <Icon class="text-gray-400 w-5 h-5" name="bx:bx-message-rounded" />
+ <span class="text-gray-600">WeChat: m1245207870</span>
+ </div>
+ <div class="flex items-center space-x-2.5">
+ <Icon class="text-gray-400 w-5 h-5" name="bx:bx-globe" />
+ <span class="text-gray-600">Primary domain: edgeever.org</span>
+ </div>
+ </div>
+ </div>
+ <div class="mt-8 pt-6 border-t border-slate-200">
+ <p class="text-xs text-slate-400 leading-normal">
+ Website content follows the sibling `edgeever` repository README, docs, and actual implementation.
+ </p>
+ </div>
+ </div>
+ </div>
+ </Container>
+</Layout>
diff --git a/apps/site/src/pages/en/index.astro b/apps/site/src/pages/en/index.astro
new file mode 100644
index 00000000..19a89c50
--- /dev/null
+++ b/apps/site/src/pages/en/index.astro
@@ -0,0 +1,40 @@
+---
+import Container from "@/components/container.astro";
+import Features from "@/components/features.astro";
+import Hero from "@/components/hero.astro";
+import Logos from "@/components/logos.astro";
+import Layout from "@/layouts/Layout.astro";
+
+const siteUrl = new URL(Astro.url.pathname, Astro.site).toString();
+
+const homeJsonLd = [
+ {
+ "@context": "https://schema.org",
+ "@type": "WebSite",
+ name: "EdgeEver",
+ url: siteUrl,
+ inLanguage: "en-US",
+ description: "EdgeEver is an open-source, self-hosted, Cloudflare-native notes workspace.",
+ },
+ {
+ "@context": "https://schema.org",
+ "@type": "SoftwareApplication",
+ name: "EdgeEver",
+ url: siteUrl,
+ codeRepository: "https://github.com/msh01/edgeever",
+ applicationCategory: "ProductivityApplication",
+ operatingSystem: "Web",
+ isAccessibleForFree: true,
+ description:
+ "EdgeEver is an open-source, self-hosted, Cloudflare-native notes workspace with a classic three-pane workflow, REST API, OpenAPI schema, and MCP endpoint.",
+ },
+];
+---
+
+<Layout title="" jsonLd={homeJsonLd}>
+ <Container>
+ <Hero />
+ <Features />
+ <Logos />
+ </Container>
+</Layout>
diff --git a/apps/web/src/components/AssetsPane.tsx b/apps/web/src/components/AssetsPane.tsx
index 3f006ad7..94bc07c3 100644
--- a/apps/web/src/components/AssetsPane.tsx
+++ b/apps/web/src/components/AssetsPane.tsx
@@ -1,5 +1,6 @@
import { useState, useCallback, useMemo, useRef } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
import { useDropzone } from "react-dropzone";
import Lightbox from "yet-another-react-lightbox";
import Zoom from "yet-another-react-lightbox/plugins/zoom";
@@ -117,6 +118,7 @@ interface AssetsPaneProps {
}
export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
+ const { t } = useTranslation();
const queryClient = useQueryClient();
const fileInputRef = useRef<HTMLInputElement>(null);
@@ -156,20 +158,20 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
let count = 0;
for (const file of files) {
count++;
- setUploadProgress(`正在上传第 ${count}/${files.length} 个文件...`);
+ setUploadProgress(t("assets.uploadNth", { current: count, total: files.length }));
const isImage = file.type.startsWith("image/");
// Compress images if enabled
const shouldCompress = isImage;
if (shouldCompress) {
setUploadState("compressing");
- setUploadProgress(`正在压缩: ${file.name}`);
+ setUploadProgress(t("assets.compressingFile", { filename: file.name }));
}
const uploadFile = shouldCompress ? (await compressImageForUpload(file)).file : file;
setUploadState("uploading");
- setUploadProgress(`正在上传: ${uploadFile.name}`);
+ setUploadProgress(t("assets.uploadingFile", { filename: uploadFile.name }));
await api.uploadMemoResource(targetMemoId, uploadFile);
}
@@ -182,7 +184,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
setTimeout(() => setUploadState("idle"), 3000);
}
},
- [activeMemo, queryClient]
+ [activeMemo, queryClient, t]
);
const { getRootProps, getInputProps, isDragActive } = useDropzone({
@@ -245,6 +247,11 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
}
};
+ const activeMemoTitle = activeMemo?.title || activeMemo?.excerpt || t("assets.unnamedMemo");
+ const activeMemoShortTitle = activeMemo?.title || activeMemo?.excerpt || t("assets.unnamedShort");
+ const getResourceMemoSource = (resource: { memoDeleted: boolean; memoTitle: string | null; memoExcerpt: string | null; memoId: string }) =>
+ resource.memoDeleted ? t("assets.deletedMemo") : resource.memoTitle || resource.memoExcerpt || resource.memoId;
+
return (
<div
{...getRootProps()}
@@ -258,8 +265,8 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
<Button
size="icon"
variant="ghost"
- title="返回"
- aria-label="返回"
+ title={t("common.back")}
+ aria-label={t("common.back")}
onClick={onClose}
className="flex h-9 w-9 items-center justify-center rounded-lg hover:bg-slate-100"
>
@@ -268,7 +275,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
<div className="min-w-0">
<h1 className="flex items-center gap-2 text-base font-bold text-slate-900 leading-tight">
<Archive className="h-4.5 w-4.5 text-emerald-700" />
- 附件管理
+ {t("assets.title")}
</h1>
<p className="mt-0.5 flex flex-wrap items-center gap-2 text-[10px] font-medium text-slate-400 uppercase tracking-wider">
<span className="inline-flex items-center gap-1">
@@ -276,9 +283,9 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
{formatBytes(summary.totalBytes)}
</span>
<span>•</span>
- <span>{summary.totalCount} 文件</span>
+ <span>{t("assets.fileCount", { count: summary.totalCount })}</span>
<span>•</span>
- <span>{summary.imageCount} 图片</span>
+ <span>{t("assets.imageCount", { count: summary.imageCount })}</span>
</p>
</div>
</div>
@@ -298,10 +305,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
: "text-slate-500 hover:bg-slate-50 border border-transparent"
}`}
>
- {type === "all" && "全部"}
- {type === "image" && "图片"}
- {type === "document" && "文档"}
- {type === "other" && "其他"}
+ {t(`assets.filters.${type}`)}
</button>
))}
</div>
@@ -313,7 +317,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
<Search className="absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" />
<input
type="text"
- placeholder="搜索附件名或来源笔记..."
+ placeholder={t("assets.searchPlaceholder")}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="h-8.5 w-full rounded-lg border border-slate-200 bg-slate-50/50 pl-8.5 pr-8 text-xs text-slate-800 placeholder-slate-400 transition-colors focus:border-emerald-500/50 focus:bg-white focus:outline-none focus:ring-1 focus:ring-emerald-500/20"
@@ -332,7 +336,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
<div className="flex items-center gap-0.5 rounded-lg border border-slate-200 p-0.5 bg-slate-50/50">
<button
onClick={() => setLayoutMode("grid")}
- title="网格视图"
+ title={t("assets.gridView")}
className={`rounded-md p-1 transition-colors ${
layoutMode === "grid" ? "bg-white text-emerald-700 shadow-sm" : "text-slate-400 hover:text-slate-600"
}`}
@@ -341,7 +345,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
</button>
<button
onClick={() => setLayoutMode("list")}
- title="列表视图"
+ title={t("assets.listView")}
className={`rounded-md p-1 transition-colors ${
layoutMode === "list" ? "bg-white text-emerald-700 shadow-sm" : "text-slate-400 hover:text-slate-600"
}`}
@@ -356,7 +360,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
{activeMemo ? (
<div className="flex items-center justify-between border-b border-emerald-100 bg-emerald-50/30 px-6 py-2 shrink-0">
<p className="truncate text-[11px] font-medium text-emerald-800">
- 📌 当前关联笔记:《{activeMemo.title || activeMemo.excerpt || "未命名笔记"}》
+ {t("assets.activeMemo", { title: activeMemoTitle })}
</p>
<div className="flex items-center gap-2">
<input
@@ -374,12 +378,12 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
{uploadState === "idle" ? (
<>
<FileUp className="h-3 w-3" />
- 上传附件
+ {t("assets.uploadAttachment")}
</>
) : (
<>
<Loader2 className="h-3 w-3 animate-spin" />
- 处理中...
+ {t("assets.processing")}
</>
)}
</button>
@@ -387,7 +391,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
</div>
) : (
<div className="border-b border-amber-100 bg-amber-50/30 px-6 py-2 text-[11px] font-medium text-amber-800 shrink-0">
- ⚠️ 提示:在右侧编辑器中打开一篇笔记,即可在此处拖放或上传新文件。
+ {t("assets.noActiveMemoHint")}
</div>
)}
@@ -397,18 +401,18 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
{resourcesQuery.isLoading ? (
<div className="flex flex-col items-center justify-center py-32 text-slate-400">
<Loader2 className="h-8 w-8 animate-spin text-emerald-600 mb-2" />
- <span className="text-xs font-medium">正在加载附件列表...</span>
+ <span className="text-xs font-medium">{t("assets.loading")}</span>
</div>
) : filteredResources.length === 0 ? (
<div className="flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-slate-200 bg-white px-6 py-24 text-center">
<Archive className="h-10 w-10 text-slate-350 mb-3 stroke-[1.5]" />
<p className="text-sm font-semibold text-slate-500">
- {searchQuery || filterType !== "all" ? "未找到匹配附件" : "暂无附件"}
+ {searchQuery || filterType !== "all" ? t("assets.noMatches") : t("assets.empty")}
</p>
<p className="mt-1 text-xs text-slate-400">
{searchQuery || filterType !== "all"
- ? "请尝试更改搜索词或分类过滤器"
- : "拖拽文件到这里,或在上方上传文件"}
+ ? t("assets.noMatchesDescription")
+ : t("assets.emptyDescription")}
</p>
</div>
) : layoutMode === "grid" ? (
@@ -448,7 +452,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
{/* Hover detail overlay */}
<div className="absolute inset-0 bg-slate-900/40 opacity-0 transition-opacity duration-200 group-hover:opacity-100 flex items-center justify-center">
<span className="rounded bg-white/90 px-2.5 py-1.5 text-[11px] font-semibold text-slate-800 shadow flex items-center gap-1">
- {resource.kind === "image" ? "大图预览" : "下载/打开"}
+ {resource.kind === "image" ? t("assets.previewImage") : t("assets.downloadOpen")}
<ExternalLink className="h-3 w-3" />
</span>
</div>
@@ -469,12 +473,12 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
<span
title={
resource.memoDeleted
- ? "已删除笔记"
- : `来自:${resource.memoTitle || resource.memoExcerpt || resource.memoId}`
+ ? t("assets.deletedMemo")
+ : t("assets.fromMemo", { source: resource.memoTitle || resource.memoExcerpt || resource.memoId })
}
className="mt-1.5 truncate text-[9px] text-slate-400 border-t border-slate-50 pt-1"
>
- 📄 {resource.memoDeleted ? "已删除笔记" : resource.memoTitle || resource.memoExcerpt || "未命名笔记"}
+ 📄 {resource.memoDeleted ? t("assets.deletedMemo") : resource.memoTitle || resource.memoExcerpt || t("assets.unnamedMemo")}
</span>
</div>
</div>
@@ -521,9 +525,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
{formatDateTime(resource.createdAt)}
</span>
<span className="mt-1 block truncate text-[10px] text-slate-500">
- 来源笔记:{resource.memoDeleted
- ? "已删除笔记"
- : resource.memoTitle || resource.memoExcerpt || resource.memoId}
+ {t("assets.sourceMemo", { source: getResourceMemoSource(resource) })}
</span>
</div>
@@ -532,7 +534,7 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
href={resource.url}
target="_blank"
rel="noreferrer"
- title="在新窗口打开"
+ title={t("assets.openInNewWindow")}
className="flex h-8 w-8 items-center justify-center rounded-lg text-slate-350 hover:bg-slate-50 hover:text-emerald-600 opacity-0 group-hover:opacity-100 transition-all duration-150"
>
<ExternalLink className="h-4 w-4" />
@@ -549,10 +551,10 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
<div className="absolute inset-0 z-50 flex flex-col items-center justify-center bg-emerald-900/80 backdrop-blur-sm p-6 text-center text-white transition-all duration-200">
<div className="rounded-2xl border-2 border-dashed border-emerald-200 bg-emerald-950/40 p-12 flex flex-col items-center max-w-md shadow-2xl">
<UploadCloud className="h-16 w-16 text-emerald-300 animate-bounce mb-4" />
- <h3 className="text-lg font-bold">将文件释放于此</h3>
+ <h3 className="text-lg font-bold">{t("assets.dropTitle")}</h3>
<p className="mt-2 text-sm text-emerald-200 leading-relaxed">
- 文件将上传并附加到当前正在编辑的笔记:
- <span className="block mt-1 font-bold text-white">《{activeMemo.title || activeMemo.excerpt || "未命名"}》</span>
+ {t("assets.dropDescription")}
+ <span className="block mt-1 font-bold text-white">{activeMemoShortTitle}</span>
</p>
</div>
</div>
@@ -576,13 +578,13 @@ export const AssetsPane = ({ onClose, activeMemo }: AssetsPaneProps) => {
{uploadState === "success" && (
<>
<span className="flex h-5 w-5 items-center justify-center rounded-full bg-emerald-50 text-emerald-650 text-xs font-bold font-mono">✓</span>
- <span className="text-xs font-semibold text-emerald-700">上传成功!</span>
+ <span className="text-xs font-semibold text-emerald-700">{t("assets.uploadSuccess")}</span>
</>
)}
{uploadState === "error" && (
<>
<span className="flex h-5 w-5 items-center justify-center rounded-full bg-rose-50 text-rose-600 text-xs font-bold font-mono">✕</span>
- <span className="text-xs font-semibold text-rose-700">上传失败,请稍后重试</span>
+ <span className="text-xs font-semibold text-rose-700">{t("assets.uploadError")}</span>
</>
)}
</div>
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index 53b1481e..23099557 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -1,5 +1,6 @@
import { useRef, useState, useEffect, useCallback, useMemo, type PointerEvent as ReactPointerEvent, type ReactNode } from "react";
import { useQueryClient, useMutation } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
import { NodeViewWrapper, ReactNodeViewRenderer, useEditor, EditorContent, type Editor, type NodeViewProps } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import Image from "@tiptap/extension-image";
@@ -57,7 +58,6 @@ import { localDb, type MemoUpdateSyncPayload } from "@/lib/local-db";
import { getMemoUpdateQueueId, queueMemoUpdate, shouldQueueMemoSaveError } from "@/lib/sync-queue";
import {
getNotebookMoveOptions,
- DEFAULT_MEMO_TITLE,
} from "@/lib/app-helpers";
const SUPPORTED_PASTE_IMAGE_TYPES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp", "image/avif"]);
@@ -150,6 +150,7 @@ const parseImageWidth = (value: unknown) => {
};
const ResizableImageNodeView = ({ editor, node, selected, updateAttributes }: NodeViewProps) => {
+ const { t } = useTranslation();
const wrapperRef = useRef<HTMLDivElement | null>(null);
const width = parseImageWidth(node.attrs.width) ?? DEFAULT_IMAGE_WIDTH_PERCENT;
const editable = editor.isEditable;
@@ -215,14 +216,14 @@ const ResizableImageNodeView = ({ editor, node, selected, updateAttributes }: No
<img src={src} alt={alt} title={title || undefined} draggable={false} />
{editable && selected && (
<div className="edgeever-image-controls" contentEditable={false}>
- <div className="edgeever-image-presets" aria-label="图片缩放">
+ <div className="edgeever-image-presets" aria-label={t("editor.imageScale")}>
{IMAGE_WIDTH_PRESETS.map((preset) => (
<button
key={preset}
type="button"
className={cn("edgeever-image-preset", width === preset && "is-active")}
- title={`缩放到 ${preset}%`}
- aria-label={`缩放到 ${preset}%`}
+ title={t("editor.scaleTo", { percent: preset })}
+ aria-label={t("editor.scaleTo", { percent: preset })}
onClick={() => updateWidth(preset)}
>
{preset}
@@ -232,8 +233,8 @@ const ResizableImageNodeView = ({ editor, node, selected, updateAttributes }: No
<button
type="button"
className="edgeever-image-resize-handle"
- title="拖拽调整图片宽度"
- aria-label="拖拽调整图片宽度"
+ title={t("editor.resizeImage")}
+ aria-label={t("editor.resizeImage")}
onPointerDown={startResize}
/>
</div>
@@ -299,6 +300,7 @@ const MobileNotebookSelectSheet = ({
onClose: () => void;
onSelect: (notebookId: string) => void;
}) => {
+ const { t } = useTranslation();
const listRef = useRef<HTMLDivElement | null>(null);
useEffect(() => {
@@ -315,16 +317,16 @@ const MobileNotebookSelectSheet = ({
<DrawerContent className="inset-x-0 max-h-[62dvh] overflow-hidden border-x-0 border-b-0 pb-[env(safe-area-inset-bottom)] lg:hidden">
<header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
<DrawerHeader className="min-w-0 p-0">
- <DrawerTitle className="text-base">所在笔记本</DrawerTitle>
+ <DrawerTitle className="text-base">{t("editor.currentNotebook")}</DrawerTitle>
</DrawerHeader>
- <Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
+ <Button size="icon" variant="ghost" title={t("editor.close")} aria-label={t("editor.close")} onClick={onClose}>
<X className="h-4 w-4" />
</Button>
</header>
<Command className="min-h-0 flex-1">
- <CommandInput placeholder="搜索笔记本" />
+ <CommandInput placeholder={t("editor.searchNotebook")} />
<CommandList ref={listRef} className="max-h-[calc(62dvh-6.25rem-env(safe-area-inset-bottom))] p-2">
- <CommandEmpty>没有找到笔记本</CommandEmpty>
+ <CommandEmpty>{t("editor.noNotebookFound")}</CommandEmpty>
<CommandGroup>
{options.map((option) => {
const selected = option.id === selectedNotebookId;
@@ -339,7 +341,7 @@ const MobileNotebookSelectSheet = ({
value={option.id}
keywords={[option.name, option.selectLabel, option.slug ?? ""]}
data-mobile-notebook-select-id={option.id}
- aria-label={selected ? `当前所在笔记本:${option.name}` : `切换到 ${option.name}`}
+ aria-label={selected ? t("editor.currentNotebookAria", { name: option.name }) : t("editor.switchToNotebook", { name: option.name })}
aria-current={selected ? "page" : undefined}
disabled={isUpdating}
onSelect={() => onSelect(option.id)}
@@ -397,6 +399,7 @@ export const EditorPane = ({
replaceFocusToken: number;
selectionActionBar?: ReactNode;
}) => {
+ const { t } = useTranslation();
const queryClient = useQueryClient();
const isSelectionMode = Boolean(selectionActionBar);
const [title, setTitle] = useState("");
@@ -532,7 +535,7 @@ export const EditorPane = ({
window.setTimeout(() => setImageUploadState("idle"), 2200);
}
})();
- }, [queryClient]);
+ }, [queryClient, t]);
const insertResourceFiles = useCallback((files: File[]) => {
const currentMemo = memoRef.current;
@@ -581,7 +584,7 @@ export const EditorPane = ({
.focus()
.insertContent({
type: "paragraph",
- content: [{ type: "text", text: `附件:${resource.filename || file.name} ${resource.url}` }],
+ content: [{ type: "text", text: t("editor.attachmentInsertText", { filename: resource.filename || file.name, url: resource.url }) }],
})
.run();
}
@@ -603,7 +606,7 @@ export const EditorPane = ({
inline: false,
}),
Placeholder.configure({
- placeholder: "开始记录...",
+ placeholder: t("editor.placeholder"),
}),
],
content: memo?.contentJson ?? { type: "doc", content: [{ type: "paragraph" }] },
@@ -1030,7 +1033,7 @@ export const EditorPane = ({
return (
<div className="flex h-full min-w-0 flex-col bg-white">
{selectionActionBar}
- <div className="flex min-h-0 flex-1 items-center justify-center text-sm text-slate-500">加载中</div>
+ <div className="flex min-h-0 flex-1 items-center justify-center text-sm text-slate-500">{t("editor.loading")}</div>
</div>
);
}
@@ -1042,7 +1045,7 @@ export const EditorPane = ({
<div className="flex min-h-0 flex-1 items-center justify-center px-8 text-center">
<div>
<Sparkles className="mx-auto mb-3 h-8 w-8 text-slate-300 animate-pulse" />
- <div className="text-sm font-medium text-slate-400">选择或新建一条笔记</div>
+ <div className="text-sm font-medium text-slate-400">{t("editor.emptySelection")}</div>
</div>
</div>
</div>
@@ -1051,18 +1054,18 @@ export const EditorPane = ({
const saveLabel =
saveState === "saving"
- ? "保存中"
+ ? t("editor.saveState.saving")
: saveState === "saved"
- ? "已保存"
+ ? t("editor.saveState.saved")
: saveState === "queued"
- ? "待同步"
+ ? t("editor.saveState.queued")
: saveState === "conflict"
- ? "有冲突"
+ ? t("editor.saveState.conflict")
: saveState === "error"
- ? "保存失败"
+ ? t("editor.saveState.error")
: hasUnsavedChanges
- ? "未保存"
- : "已保存";
+ ? t("editor.saveState.unsaved")
+ : t("editor.saveState.saved");
const saveStateClassName =
saveState === "error" || saveState === "conflict"
@@ -1075,11 +1078,11 @@ export const EditorPane = ({
const imageUploadLabel =
imageUploadState === "error"
- ? "上传失败"
+ ? t("editor.uploadState.failed")
: imageUploadState === "compressing"
- ? "压缩中"
+ ? t("editor.uploadState.compressing")
: imageUploadState === "uploading"
- ? "上传中"
+ ? t("editor.uploadState.uploading")
: null;
const mobileStatusLabel = imageUploadLabel ?? saveLabel;
@@ -1091,7 +1094,7 @@ export const EditorPane = ({
: saveStateClassName;
const updatedLabel = formatDateTime(memo.updatedAt);
- const currentNotebookLabel = notebookOptions.find((notebook) => notebook.id === memo.notebookId)?.name ?? "笔记本";
+ const currentNotebookLabel = notebookOptions.find((notebook) => notebook.id === memo.notebookId)?.name ?? t("editor.notebookFallback");
const mobileDoneDisabled =
saveMutation.isPending ||
@@ -1189,8 +1192,8 @@ export const EditorPane = ({
className="lg:hidden"
size="icon"
variant="ghost"
- title={hasUnsavedChanges && !readOnly ? "保存并返回列表" : "返回列表"}
- aria-label={hasUnsavedChanges && !readOnly ? "保存并返回列表" : "返回列表"}
+ title={hasUnsavedChanges && !readOnly ? t("editor.saveAndBack") : t("editor.backToList")}
+ aria-label={hasUnsavedChanges && !readOnly ? t("editor.saveAndBack") : t("editor.backToList")}
disabled={mobileDoneDisabled}
onClick={handleMobileBack}
>
@@ -1200,8 +1203,8 @@ export const EditorPane = ({
<button
className="flex h-8 w-8 items-center justify-center rounded-md text-slate-500 transition hover:bg-slate-50 hover:text-slate-900 disabled:opacity-30"
type="button"
- title="上一条笔记"
- aria-label="上一条笔记"
+ title={t("editor.previousMemo")}
+ aria-label={t("editor.previousMemo")}
disabled={!hasPreviousMemo}
onClick={onOpenPreviousMemo}
>
@@ -1210,8 +1213,8 @@ export const EditorPane = ({
<button
className="flex h-8 w-8 items-center justify-center rounded-md text-slate-500 transition hover:bg-slate-50 hover:text-slate-900 disabled:opacity-30"
type="button"
- title="下一条笔记"
- aria-label="下一条笔记"
+ title={t("editor.nextMemo")}
+ aria-label={t("editor.nextMemo")}
disabled={!hasNextMemo}
onClick={onOpenNextMemo}
>
@@ -1219,15 +1222,15 @@ export const EditorPane = ({
</button>
</div>
<div className="hidden items-center gap-1 lg:flex">
- <Button size="icon" variant="ghost" title="上一条笔记" aria-label="上一条笔记" onClick={onOpenPreviousMemo} disabled={!hasPreviousMemo}>
+ <Button size="icon" variant="ghost" title={t("editor.previousMemo")} aria-label={t("editor.previousMemo")} onClick={onOpenPreviousMemo} disabled={!hasPreviousMemo}>
<ChevronLeft className="h-4 w-4" />
</Button>
- <Button size="icon" variant="ghost" title="下一条笔记" aria-label="下一条笔记" onClick={onOpenNextMemo} disabled={!hasNextMemo}>
+ <Button size="icon" variant="ghost" title={t("editor.nextMemo")} aria-label={t("editor.nextMemo")} onClick={onOpenNextMemo} disabled={!hasNextMemo}>
<ChevronRight className="h-4 w-4" />
</Button>
</div>
<span className="hidden truncate text-xs text-slate-400 sm:inline">
- 更新于 {updatedLabel}
+ {t("editor.updatedAt", { time: updatedLabel })}
</span>
</div>
@@ -1242,10 +1245,10 @@ export const EditorPane = ({
)}
>
{imageUploadState === "error"
- ? "文件上传失败"
+ ? t("editor.uploadState.fileFailed")
: imageUploadState === "compressing"
- ? "图片压缩中"
- : "文件上传中"}
+ ? t("editor.uploadState.imageCompressing")
+ : t("editor.uploadState.fileUploading")}
</span>
)}
<span className={cn("hidden rounded-md px-2 py-1 text-xs font-medium sm:inline-flex", saveStateClassName)}>
@@ -1261,7 +1264,7 @@ export const EditorPane = ({
disabled={mobileDoneDisabled}
onClick={handleMobileDone}
>
- {saveMutation.isPending ? "保存中" : "完成"}
+ {saveMutation.isPending ? t("editor.saveState.saving") : t("editor.done")}
</button>
)}
<input
@@ -1280,8 +1283,8 @@ export const EditorPane = ({
className="sm:hidden"
size="icon"
variant="ghost"
- title="上传附件"
- aria-label="上传附件"
+ title={t("editor.uploadAttachment")}
+ aria-label={t("editor.uploadAttachment")}
disabled={mobileDoneDisabled || effectiveReadOnly}
onClick={() => fileInputRef.current?.click()}
>
@@ -1293,8 +1296,8 @@ export const EditorPane = ({
className="sm:hidden"
size="icon"
variant={mobileToolbarOpen ? "soft" : "ghost"}
- title={mobileToolbarOpen ? "收起格式" : "格式"}
- aria-label={mobileToolbarOpen ? "收起格式" : "格式"}
+ title={mobileToolbarOpen ? t("editor.collapseFormat") : t("editor.format")}
+ aria-label={mobileToolbarOpen ? t("editor.collapseFormat") : t("editor.format")}
aria-pressed={mobileToolbarOpen}
disabled={effectiveReadOnly}
onClick={() => setMobileToolbarOpen((open) => !open)}
@@ -1302,10 +1305,10 @@ export const EditorPane = ({
<Type className="h-4 w-4" />
</Button>
)}
- <Button className="hidden sm:inline-flex" size="icon" variant="ghost" title="搜索当前笔记" aria-label="搜索当前笔记" onClick={() => openNoteSearch()}>
+ <Button className="hidden sm:inline-flex" size="icon" variant="ghost" title={t("editor.searchCurrentMemo")} aria-label={t("editor.searchCurrentMemo")} onClick={() => openNoteSearch()}>
<Search className="h-4 w-4" />
</Button>
- <Button className="hidden sm:inline-flex" size="icon" variant="ghost" title="版本历史" aria-label="版本历史" onClick={() => setHistoryOpen(true)}>
+ <Button className="hidden sm:inline-flex" size="icon" variant="ghost" title={t("editor.versionHistory")} aria-label={t("editor.versionHistory")} onClick={() => setHistoryOpen(true)}>
<History className="h-4 w-4" />
</Button>
<GitHubRepositoryLink className="hidden h-8 w-8 justify-center rounded-md text-slate-500 transition hover:bg-slate-50 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70 lg:inline-flex" />
@@ -1314,8 +1317,8 @@ export const EditorPane = ({
className="hidden sm:inline-flex"
size="icon"
variant="solid"
- title="保存"
- aria-label="保存"
+ title={t("editor.save")}
+ aria-label={t("editor.save")}
onClick={() => saveMutation.mutate()}
disabled={!editor || saveMutation.isPending || !hasUnsavedChanges}
>
@@ -1328,8 +1331,8 @@ export const EditorPane = ({
className={cn(!isMobileEditing && !readOnly && "hidden sm:inline-flex")}
size="icon"
variant="ghost"
- title="更多"
- aria-label="笔记更多操作"
+ title={t("editor.more")}
+ aria-label={t("editor.moreAria")}
>
<MoreHorizontal className="h-4 w-4" />
</Button>
@@ -1340,14 +1343,14 @@ export const EditorPane = ({
onClick={() => openNoteSearch()}
>
<Search className="h-4 w-4 text-slate-500" />
- 搜索当前笔记
+ {t("editor.searchCurrentMemo")}
</DropdownMenuItem>
<DropdownMenuItem
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"
onClick={openNoteReplace}
>
<ReplaceAll className="h-4 w-4 text-slate-500" />
- 替换当前笔记
+ {t("editor.replaceCurrentMemo")}
</DropdownMenuItem>
<DropdownMenuItem
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"
@@ -1356,7 +1359,7 @@ export const EditorPane = ({
}}
>
<History className="h-4 w-4 text-slate-500" />
- 版本历史
+ {t("editor.versionHistory")}
</DropdownMenuItem>
{readOnly ? (
<>
@@ -1365,7 +1368,7 @@ export const EditorPane = ({
onClick={() => void onRestored(memo.id)}
>
<RotateCcw className="h-4 w-4 text-slate-500" />
- 恢复笔记
+ {t("editor.restoreMemo")}
</DropdownMenuItem>
<DropdownMenuSeparator className="my-1 h-px bg-slate-100" />
<DropdownMenuItem
@@ -1373,7 +1376,7 @@ export const EditorPane = ({
onClick={() => void onPermanentDeleted(memo.id)}
>
<Trash2 className="h-4 w-4" />
- 彻底删除
+ {t("editor.deleteForever")}
</DropdownMenuItem>
</>
) : (
@@ -1384,7 +1387,7 @@ export const EditorPane = ({
onClick={() => void onDeleted(memo.id)}
>
<Trash2 className="h-4 w-4" />
- 删除笔记
+ {t("editor.deleteMemo")}
</DropdownMenuItem>
</>
)}
@@ -1403,15 +1406,15 @@ export const EditorPane = ({
markDirty();
}}
className="block w-full rounded-md border-0 bg-transparent text-2xl font-bold leading-tight text-slate-950 outline-none transition placeholder:text-slate-300 focus-visible:bg-slate-50 focus-visible:shadow-[inset_3px_0_0_var(--brand-green)] sm:text-3xl"
- placeholder={DEFAULT_MEMO_TITLE}
+ placeholder={t("common.untitledMemo")}
/>
<div className="flex flex-wrap items-center gap-2">
<button
className="flex h-8 min-w-0 max-w-full items-center gap-1 rounded-md border border-transparent bg-transparent px-2 text-sm font-medium text-slate-600 outline-none transition hover:border-slate-200 hover:bg-slate-50 hover:text-slate-900 focus-visible:border-emerald-300 focus-visible:ring-2 focus-visible:ring-emerald-500/20 disabled:opacity-50 sm:hidden"
type="button"
disabled={effectiveReadOnly || notebookUpdatePending}
- title="所在笔记本"
- aria-label={`所在笔记本:${currentNotebookLabel}`}
+ title={t("editor.currentNotebook")}
+ aria-label={t("editor.currentNotebookAria", { name: currentNotebookLabel })}
onClick={() => setMobileNotebookSheetOpen(true)}
>
<span className="min-w-0 truncate">{currentNotebookLabel}</span>
@@ -1424,7 +1427,7 @@ export const EditorPane = ({
onValueChange={(value) => handleNotebookChange(value)}
>
<SelectTrigger className="h-8 min-w-0 border-transparent bg-transparent px-2 text-sm font-medium text-slate-600 hover:border-slate-200 hover:bg-slate-50 hover:text-slate-900 whitespace-nowrap">
- <SelectValue placeholder="所在笔记本" />
+ <SelectValue placeholder={t("editor.notebookPlaceholder")} />
</SelectTrigger>
<SelectContent className="max-h-60 bg-white border border-slate-200 rounded-md py-1 shadow-md">
{notebookOptions.map((notebook) => (
@@ -1446,7 +1449,7 @@ export const EditorPane = ({
markDirty();
}}
className="min-w-0 flex-1 bg-transparent outline-none placeholder:text-slate-400"
- placeholder="添加标签,用逗号分隔"
+ placeholder={t("editor.tagPlaceholder")}
/>
</label>
</div>
@@ -1458,7 +1461,7 @@ export const EditorPane = ({
ref={noteSearchInputRef}
value={noteSearchQuery}
className="h-8 min-w-[12rem] flex-1"
- placeholder="在当前笔记内搜索"
+ placeholder={t("editor.searchPlaceholder")}
onChange={(event) => setNoteSearchQuery(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Enter") {
@@ -1477,7 +1480,7 @@ export const EditorPane = ({
ref={noteReplaceInputRef}
value={noteSearchReplacement}
className="h-8 min-w-[12rem] flex-1"
- placeholder="替换为"
+ placeholder={t("editor.replacePlaceholder")}
disabled={effectiveReadOnly}
onChange={(event) => setNoteSearchReplacement(event.target.value)}
onKeyDown={(event) => {
@@ -1505,8 +1508,8 @@ export const EditorPane = ({
<Button
size="icon"
variant="ghost"
- title="上一个搜索结果"
- aria-label="上一个搜索结果"
+ title={t("editor.previousSearchResult")}
+ aria-label={t("editor.previousSearchResult")}
disabled={noteSearchMatches.length === 0}
onClick={() => moveNoteSearchMatch(-1)}
>
@@ -1515,8 +1518,8 @@ export const EditorPane = ({
<Button
size="icon"
variant="ghost"
- title="下一个搜索结果"
- aria-label="下一个搜索结果"
+ title={t("editor.nextSearchResult")}
+ aria-label={t("editor.nextSearchResult")}
disabled={noteSearchMatches.length === 0}
onClick={() => moveNoteSearchMatch(1)}
>
@@ -1526,16 +1529,16 @@ export const EditorPane = ({
<Button
size="sm"
variant="solid"
- title="全部替换"
- aria-label="全部替换"
+ title={t("editor.replaceAll")}
+ aria-label={t("editor.replaceAll")}
disabled={effectiveReadOnly || noteSearchMatches.length === 0}
onClick={replaceAllNoteSearchMatches}
>
<ReplaceAll className="h-4 w-4" />
- 全部替换
+ {t("editor.replaceAll")}
</Button>
)}
- <Button size="icon" variant="ghost" title="关闭搜索" aria-label="关闭搜索" onClick={closeNoteSearch}>
+ <Button size="icon" variant="ghost" title={t("editor.closeSearch")} aria-label={t("editor.closeSearch")} onClick={closeNoteSearch}>
<X className="h-4 w-4" />
</Button>
</div>
@@ -1552,8 +1555,8 @@ export const EditorPane = ({
className="fixed bottom-[calc(1rem+env(safe-area-inset-bottom))] right-4 z-30 h-12 w-12 rounded-full shadow-lg sm:hidden"
size="icon"
variant="solid"
- title="编辑笔记"
- aria-label="编辑笔记"
+ title={t("editor.editMemo")}
+ aria-label={t("editor.editMemo")}
onClick={() => setIsMobileEditing(true)}
>
<Pencil className="h-5 w-5" />
diff --git a/apps/web/src/components/EditorToolbar.tsx b/apps/web/src/components/EditorToolbar.tsx
index b29d5044..08fbcc59 100644
--- a/apps/web/src/components/EditorToolbar.tsx
+++ b/apps/web/src/components/EditorToolbar.tsx
@@ -1,5 +1,6 @@
import type { ReactNode } from "react";
import type { Editor } from "@tiptap/react";
+import { useTranslation } from "react-i18next";
import {
Undo2,
Redo2,
@@ -82,6 +83,7 @@ const toggleCodeBlock = (editor: Editor) => {
};
export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; readOnly: boolean }) => {
+ const { t } = useTranslation();
const editorReady = isToolbarEditorReady(editor);
const disabled = readOnly || !editorReady;
const blockValue = getActiveBlockValue(editor);
@@ -154,7 +156,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<div
className="flex min-h-12 items-center gap-2 overflow-x-auto px-3 py-2 [scrollbar-width:none] sm:px-5 [&::-webkit-scrollbar]:hidden"
role="toolbar"
- aria-label="编辑器工具栏"
+ aria-label={t("editorToolbar.toolbar")}
>
<Select
value={blockValue}
@@ -162,26 +164,26 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
onValueChange={(value) => setBlock(value)}
>
<SelectTrigger className="h-8 w-20 shrink-0 whitespace-nowrap border-slate-200 bg-white text-xs text-slate-800 [&>span]:truncate [&>span]:whitespace-nowrap">
- <SelectValue placeholder="正文" />
+ <SelectValue placeholder={t("editorToolbar.paragraph")} />
</SelectTrigger>
<SelectContent className="bg-white border border-slate-200 rounded-md py-1 shadow-md">
- <SelectItem value="paragraph">正文</SelectItem>
- <SelectItem value="heading-1">标题 1</SelectItem>
- <SelectItem value="heading-2">标题 2</SelectItem>
- <SelectItem value="heading-3">标题 3</SelectItem>
+ <SelectItem value="paragraph">{t("editorToolbar.paragraph")}</SelectItem>
+ <SelectItem value="heading-1">{t("editorToolbar.heading1")}</SelectItem>
+ <SelectItem value="heading-2">{t("editorToolbar.heading2")}</SelectItem>
+ <SelectItem value="heading-3">{t("editorToolbar.heading3")}</SelectItem>
</SelectContent>
</Select>
<ToolbarDivider />
<EditorToolbarButton
- title="撤销"
+ title={t("editorToolbar.undo")}
disabled={!canRun((current) => current.can().chain().focus().undo().run())}
onClick={() => run((current) => current.chain().focus().undo().run())}
>
<Undo2 className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="重做"
+ title={t("editorToolbar.redo")}
disabled={!canRun((current) => current.can().chain().focus().redo().run())}
onClick={() => run((current) => current.chain().focus().redo().run())}
>
@@ -190,7 +192,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<ToolbarDivider />
<EditorToolbarButton
- title="加粗"
+ title={t("editorToolbar.bold")}
active={isActive("bold")}
disabled={!canRun((current) => current.can().chain().focus().toggleBold().run())}
onClick={() => run((current) => current.chain().focus().toggleBold().run())}
@@ -198,7 +200,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<Bold className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="斜体"
+ title={t("editorToolbar.italic")}
active={isActive("italic")}
disabled={!canRun((current) => current.can().chain().focus().toggleItalic().run())}
onClick={() => run((current) => current.chain().focus().toggleItalic().run())}
@@ -206,7 +208,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<Italic className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="删除线"
+ title={t("editorToolbar.strike")}
active={isActive("strike")}
disabled={!canRun((current) => current.can().chain().focus().toggleStrike().run())}
onClick={() => run((current) => current.chain().focus().toggleStrike().run())}
@@ -214,7 +216,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<Strikethrough className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="行内代码"
+ title={t("editorToolbar.inlineCode")}
active={isActive("code")}
disabled={!canRun((current) => current.can().chain().focus().toggleCode().run())}
onClick={() => run((current) => current.chain().focus().toggleCode().run())}
@@ -224,7 +226,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<ToolbarDivider />
<EditorToolbarButton
- title="无序列表"
+ title={t("editorToolbar.bulletList")}
active={isActive("bulletList")}
disabled={disabled}
onClick={() => run((current) => current.chain().focus().toggleBulletList().run())}
@@ -232,7 +234,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<List className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="有序列表"
+ title={t("editorToolbar.orderedList")}
active={isActive("orderedList")}
disabled={disabled}
onClick={() => run((current) => current.chain().focus().toggleOrderedList().run())}
@@ -240,7 +242,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<ListOrdered className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="引用"
+ title={t("editorToolbar.quote")}
active={isActive("blockquote")}
disabled={disabled}
onClick={() => run((current) => current.chain().focus().toggleBlockquote().run())}
@@ -248,7 +250,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<Quote className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="代码块"
+ title={t("editorToolbar.codeBlock")}
active={isActive("codeBlock")}
disabled={disabled}
onClick={() => run(toggleCodeBlock)}
@@ -256,7 +258,7 @@ export const EditorToolbar = ({ editor, readOnly }: { editor: Editor | null; rea
<SquareCode className="h-4 w-4" />
</EditorToolbarButton>
<EditorToolbarButton
- title="分割线"
+ title={t("editorToolbar.horizontalRule")}
disabled={disabled}
onClick={() => run((current) => current.chain().focus().setHorizontalRule().run())}
>
diff --git a/apps/web/src/components/EvernoteImportGuidePane.tsx b/apps/web/src/components/EvernoteImportGuidePane.tsx
index 79d084b8..bc13444b 100644
--- a/apps/web/src/components/EvernoteImportGuidePane.tsx
+++ b/apps/web/src/components/EvernoteImportGuidePane.tsx
@@ -1,10 +1,15 @@
+import { useMemo } from "react";
import { ChevronLeft, HelpCircle } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { marked } from "marked";
import migrationGuideMarkdown from "../../../../docs/evernote-migration-guide.md?raw";
+import migrationGuideEnglishMarkdown from "../../../../docs/evernote-migration-guide.en-US.md?raw";
export const EvernoteImportGuidePane = ({ onClose }: { onClose: () => void }) => {
- const htmlContent = marked.parse(migrationGuideMarkdown) as string;
+ const { i18n, t } = useTranslation();
+ const markdown = i18n.resolvedLanguage === "en-US" ? migrationGuideEnglishMarkdown : migrationGuideMarkdown;
+ const htmlContent = useMemo(() => marked.parse(markdown) as string, [markdown]);
return (
<div className="flex h-full min-h-0 min-w-0 flex-col overflow-x-hidden bg-slate-50">
@@ -13,8 +18,8 @@ export const EvernoteImportGuidePane = ({ onClose }: { onClose: () => void }) =>
<Button
size="icon"
variant="ghost"
- title="返回"
- aria-label="返回"
+ title={t("common.back")}
+ aria-label={t("common.back")}
onClick={onClose}
className="h-9 w-9 rounded-lg hover:bg-slate-100"
>
@@ -23,10 +28,10 @@ export const EvernoteImportGuidePane = ({ onClose }: { onClose: () => void }) =>
<div className="min-w-0">
<h1 className="flex items-center gap-2 text-base font-bold leading-tight text-slate-900">
<HelpCircle className="h-4 w-4 text-emerald-700" />
- 印象笔记迁移指引
+ {t("evernoteGuide.title")}
</h1>
<p className="mt-0.5 truncate text-xs font-medium text-slate-400">
- AI Agent 驱动一键迁移,无损保留笔记本组结构
+ {t("evernoteGuide.subtitle")}
</p>
</div>
</div>
diff --git a/apps/web/src/components/GitHubRepositoryLink.tsx b/apps/web/src/components/GitHubRepositoryLink.tsx
index 71d1547b..1acb10ab 100644
--- a/apps/web/src/components/GitHubRepositoryLink.tsx
+++ b/apps/web/src/components/GitHubRepositoryLink.tsx
@@ -1,4 +1,5 @@
import { type ReactNode } from "react";
+import { useTranslation } from "react-i18next";
import { cn } from "@/lib/utils";
const GITHUB_REPOSITORY_URL = "https://github.com/msh01/edgeever";
@@ -17,22 +18,27 @@ export const GitHubRepositoryLink = ({
children,
className,
iconClassName,
- title = "GitHub 仓库",
+ title,
}: {
children?: ReactNode;
className?: string;
iconClassName?: string;
title?: string;
-}) => (
- <a
- className={cn("inline-flex items-center gap-2", className)}
- href={GITHUB_REPOSITORY_URL}
- target="_blank"
- rel="noopener noreferrer"
- title={title}
- aria-label={children ? undefined : title}
- >
- <GitHubMark className={cn("h-4 w-4 shrink-0", iconClassName)} />
- {children}
- </a>
-);
+}) => {
+ const { t } = useTranslation();
+ const resolvedTitle = title ?? t("common.githubRepository");
+
+ return (
+ <a
+ className={cn("inline-flex items-center gap-2", className)}
+ href={GITHUB_REPOSITORY_URL}
+ target="_blank"
+ rel="noopener noreferrer"
+ title={resolvedTitle}
+ aria-label={children ? undefined : resolvedTitle}
+ >
+ <GitHubMark className={cn("h-4 w-4 shrink-0", iconClassName)} />
+ {children}
+ </a>
+ );
+};
diff --git a/apps/web/src/components/LoginScreen.tsx b/apps/web/src/components/LoginScreen.tsx
index 3920fb0d..09404cf0 100644
--- a/apps/web/src/components/LoginScreen.tsx
+++ b/apps/web/src/components/LoginScreen.tsx
@@ -1,5 +1,6 @@
import { useState, type FormEvent } from "react";
import { LockKeyhole } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { GitHubRepositoryLink } from "@/components/GitHubRepositoryLink";
import { Input } from "@/components/ui/input";
@@ -23,6 +24,7 @@ const getDefaultLoginCredentials = () => {
};
export const LoginScreen = ({ error, isSubmitting, onSubmit }: LoginScreenProps) => {
+ const { t } = useTranslation();
const [username, setUsername] = useState(() => getDefaultLoginCredentials().username);
const [password, setPassword] = useState(() => getDefaultLoginCredentials().password);
@@ -48,14 +50,14 @@ export const LoginScreen = ({ error, isSubmitting, onSubmit }: LoginScreenProps)
<LockKeyhole className="h-5.5 w-5.5" />
</div>
<div className="min-w-0">
- <h1 className="text-xl font-bold leading-tight tracking-tight text-slate-900">登录 EdgeEver</h1>
- <p className="mt-1 text-xs font-medium text-slate-400 uppercase tracking-wider">自托管笔记工作区</p>
+ <h1 className="text-xl font-bold leading-tight tracking-tight text-slate-900">{t("login.title")}</h1>
+ <p className="mt-1 text-xs font-medium uppercase tracking-wider text-slate-400">{t("login.subtitle")}</p>
</div>
</div>
<form className="space-y-5" onSubmit={handleSubmit}>
<label className="block">
- <span className="mb-2 block text-sm font-semibold text-slate-700">账号</span>
+ <span className="mb-2 block text-sm font-semibold text-slate-700">{t("login.username")}</span>
<Input
autoComplete="username"
className="h-11 rounded-lg bg-slate-50/50 px-3.5 focus-visible:bg-white focus-visible:ring-4 focus-visible:ring-emerald-500/10"
@@ -65,7 +67,7 @@ export const LoginScreen = ({ error, isSubmitting, onSubmit }: LoginScreenProps)
</label>
<label className="block">
- <span className="mb-2 block text-sm font-semibold text-slate-700">密码</span>
+ <span className="mb-2 block text-sm font-semibold text-slate-700">{t("login.password")}</span>
<Input
autoComplete="current-password"
className="h-11 rounded-lg bg-slate-50/50 px-3.5 focus-visible:bg-white focus-visible:ring-4 focus-visible:ring-emerald-500/10"
@@ -89,7 +91,7 @@ export const LoginScreen = ({ error, isSubmitting, onSubmit }: LoginScreenProps)
disabled={isSubmitting}
>
<LockKeyhole className="h-4 w-4 mr-1" />
- {isSubmitting ? "安全登录中..." : "开启工作区"}
+ {isSubmitting ? t("login.submitting") : t("login.submit")}
</Button>
</form>
</section>
diff --git a/apps/web/src/components/MemoCard.tsx b/apps/web/src/components/MemoCard.tsx
index 7eecba8c..4c79a79a 100644
--- a/apps/web/src/components/MemoCard.tsx
+++ b/apps/web/src/components/MemoCard.tsx
@@ -1,16 +1,17 @@
import { useRef, useState, useEffect, type DragEvent, type MouseEvent, type PointerEvent as ReactPointerEvent, type KeyboardEvent as ReactKeyboardEvent } from "react";
+import { useTranslation } from "react-i18next";
import { Star, Check, MoreHorizontal, RotateCcw, Trash2 } from "lucide-react";
import type { MemoSummary } from "@edgeever/shared";
import { cn } from "@/lib/utils";
import type { MemoListDensity } from "@/lib/app-helpers";
-import { getMemoTitle, MEMO_DRAG_MIME, setMemoDragPreview } from "@/lib/app-helpers";
+import { MEMO_DRAG_MIME, setMemoDragPreview } from "@/lib/app-helpers";
const MEMO_LONG_PRESS_DELAY_MS = 520;
const MEMO_LONG_PRESS_MOVE_TOLERANCE_PX = 14;
const isDesktopViewport = () => window.matchMedia("(min-width: 1024px)").matches;
-const formatMemoPreviewDate = (value: string) => {
+const formatMemoPreviewDate = (value: string, locale: string, yesterdayLabel: string) => {
const date = new Date(value);
if (Number.isNaN(date.getTime())) {
@@ -22,14 +23,14 @@ const formatMemoPreviewDate = (value: string) => {
const memoDay = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
if (memoDay === today) {
- return new Intl.DateTimeFormat("zh-CN", { hour: "2-digit", minute: "2-digit" }).format(date);
+ return new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit" }).format(date);
}
if (memoDay === today - 24 * 60 * 60 * 1000) {
- return "昨天";
+ return yesterdayLabel;
}
- return new Intl.DateTimeFormat("zh-CN", {
+ return new Intl.DateTimeFormat(locale, {
year: "numeric",
month: "numeric",
day: "numeric",
@@ -71,14 +72,17 @@ export const MemoCard = ({
onOpenKeyboardContextMenu: (target: HTMLElement) => void;
onToggle: (event?: MouseEvent<HTMLElement>) => void;
}) => {
+ const { t, i18n } = useTranslation();
const handledModifierPointerRef = useRef(false);
const longPressTimerRef = useRef<number | null>(null);
const longPressPointRef = useRef<{ x: number; y: number } | null>(null);
const [modifierHoverActive, setModifierHoverActive] = useState(false);
- const memoTitle = getMemoTitle(memo.title);
- const memoExcerpt = memo.excerpt.trim() || "空笔记";
+ const memoTitle = memo.title?.trim() || t("common.untitledMemo");
+ const memoExcerpt = memo.excerpt.trim() || t("memoCard.emptyMemo");
const showSelectionControl = selectionMode || checked || multiSelectKeyDown || modifierHoverActive;
- const selectionControlLabel = checked ? `取消选择 ${memoTitle}` : `选择 ${memoTitle}`;
+ const selectionControlLabel = checked
+ ? t("memoCard.unselect", { title: memoTitle })
+ : t("memoCard.select", { title: memoTitle });
const shouldToggleSelection = (event: MouseEvent<HTMLElement>) =>
event.ctrlKey || event.metaKey || event.shiftKey || multiSelectKeyDown;
@@ -213,7 +217,9 @@ export const MemoCard = ({
return;
}
- const dragLabel = dragMemoIds.length > 1 ? `移动 ${dragMemoIds.length} 条笔记` : `移动「${memoTitle}」`;
+ const dragLabel = dragMemoIds.length > 1
+ ? t("memoCard.dragMany", { count: dragMemoIds.length })
+ : t("memoCard.dragOne", { title: memoTitle });
resetLongPress();
event.dataTransfer.effectAllowed = "move";
@@ -359,7 +365,7 @@ export const MemoCard = ({
onClick={handleClick}
onContextMenu={handleContextMenu}
onKeyDown={handleKeyDown}
- title="Ctrl/Cmd 点击切换选择,Shift 点击连续选择,可拖到左侧笔记本移动,移动端长按进入选择"
+ title={t("memoCard.interactionHint")}
>
<div className={cn("mb-2 flex min-w-0 items-center gap-1.5 text-base font-semibold leading-6 text-slate-900 lg:text-base", listDensity === "compact" && "mb-1")}>
{memo.isPinned && <Star className="h-4 w-4 shrink-0 fill-current text-slate-500" />}
@@ -374,7 +380,9 @@ export const MemoCard = ({
{memoExcerpt}
</div>
<div className={cn("mt-5 flex flex-wrap items-center gap-2", listDensity === "compact" && "mt-2")}>
- <time className="text-xs font-medium text-slate-400 lg:text-sm lg:font-normal lg:text-slate-500">{formatMemoPreviewDate(memo.updatedAt)}</time>
+ <time className="text-xs font-medium text-slate-400 lg:text-sm lg:font-normal lg:text-slate-500">
+ {formatMemoPreviewDate(memo.updatedAt, i18n.resolvedLanguage ?? i18n.language, t("memoCard.yesterday"))}
+ </time>
{memo.tags.slice(0, 3).map((tag) => (
<span key={tag} className="rounded-sm bg-slate-100 px-1.5 py-0.5 text-xs font-medium text-slate-600">
#{tag}
@@ -393,8 +401,8 @@ export const MemoCard = ({
<button
className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400/70 focus-visible:ring-offset-2"
type="button"
- title="更多操作"
- aria-label="更多操作"
+ title={t("memoCard.moreActions")}
+ aria-label={t("memoCard.moreActions")}
aria-haspopup="menu"
onClick={(event) => {
event.stopPropagation();
@@ -409,8 +417,8 @@ export const MemoCard = ({
isTrashView ? "hover:bg-slate-100 hover:text-slate-800" : "hover:bg-rose-50 hover:text-rose-700"
)}
type="button"
- title={isTrashView ? "恢复笔记" : "删除笔记"}
- aria-label={isTrashView ? "恢复笔记" : "删除笔记"}
+ title={isTrashView ? t("memoCard.restoreMemo") : t("memoCard.deleteMemo")}
+ aria-label={isTrashView ? t("memoCard.restoreMemo") : t("memoCard.deleteMemo")}
onClick={(event) => {
event.stopPropagation();
if (isTrashView) {
diff --git a/apps/web/src/components/MemoListMobileSheets.tsx b/apps/web/src/components/MemoListMobileSheets.tsx
index eaa80f39..302da9b4 100644
--- a/apps/web/src/components/MemoListMobileSheets.tsx
+++ b/apps/web/src/components/MemoListMobileSheets.tsx
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useRef, type ReactNode } from "react";
import { Archive, CheckSquare, Folder as NotebookIcon, KeyRound, LayoutList, List, Merge, Star, Tags, Trash2, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import {
Command,
@@ -18,19 +19,10 @@ import {
} from "@/components/ui/drawer";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { cn } from "@/lib/utils";
-import { MEMO_SORT_OPTIONS, getNotebookMoveOptions } from "@/lib/app-helpers";
+import { getMemoSortOptions, getNotebookMoveOptions } from "@/lib/app-helpers";
import type { MemoListDensity, MemoSortMode } from "@/lib/app-helpers";
import type { Notebook } from "@edgeever/shared";
-const getSelectionCountLabel = (count: number) => (count > 0 ? `已选择 ${count} 条` : "选择笔记");
-
-const memoListDensityOptions = [
- { value: "preview" as const, label: "预览列表", icon: <LayoutList className="h-4 w-4" /> },
- { value: "compact" as const, label: "紧凑列表", icon: <List className="h-4 w-4" /> },
-];
-
-const mobileSortOptions = MEMO_SORT_OPTIONS;
-
const CheckCircleCheck = ({ className }: { className?: string }) => (
<svg className={cn("h-4 w-4 fill-current", className)} viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path
@@ -97,90 +89,102 @@ export const MobileListActionsSheet = ({
onOpenTrash: () => void;
onListDensityChange: (value: MemoListDensity) => void;
onSortModeChange: (value: MemoSortMode) => void;
-}) => (
- <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
- <DrawerContent className="bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md lg:hidden">
- <header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
- <DrawerHeader className="min-w-0 p-0">
- <DrawerTitle className="truncate">列表选项</DrawerTitle>
- <DrawerDescription className="truncate">
- {listTitle} · {listDescription}
- </DrawerDescription>
- </DrawerHeader>
- <Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
- <X className="h-4 w-4" />
- </Button>
- </header>
- <div className="max-h-[calc(100dvh_-_10.25rem_-_env(safe-area-inset-bottom))] overflow-y-auto p-2">
- {!isSelectionMode && (
- <>
- <MobileListActionButton
- disabled={!canSelectMemos}
- icon={<CheckSquare className="h-4 w-4" />}
- label="选择笔记"
- onClick={onEnterSelectionMode}
- />
- <div className="my-2 h-px bg-slate-100" />
- </>
- )}
+}) => {
+ const { t } = useTranslation();
+ const memoListDensityOptions = useMemo(
+ () => [
+ { value: "preview" as const, label: t("options.memoDensity.preview"), icon: <LayoutList className="h-4 w-4" /> },
+ { value: "compact" as const, label: t("options.memoDensity.compact"), icon: <List className="h-4 w-4" /> },
+ ],
+ [t]
+ );
+ const mobileSortOptions = useMemo(() => getMemoSortOptions(t), [t]);
+
+ return (
+ <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
+ <DrawerContent className="bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md lg:hidden">
+ <header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
+ <DrawerHeader className="min-w-0 p-0">
+ <DrawerTitle className="truncate">{t("mobileSheets.listOptions")}</DrawerTitle>
+ <DrawerDescription className="truncate">
+ {listTitle} · {listDescription}
+ </DrawerDescription>
+ </DrawerHeader>
+ <Button size="icon" variant="ghost" title={t("common.close")} aria-label={t("common.close")} onClick={onClose}>
+ <X className="h-4 w-4" />
+ </Button>
+ </header>
+ <div className="max-h-[calc(100dvh_-_10.25rem_-_env(safe-area-inset-bottom))] overflow-y-auto p-2">
+ {!isSelectionMode && (
+ <>
+ <MobileListActionButton
+ disabled={!canSelectMemos}
+ icon={<CheckSquare className="h-4 w-4" />}
+ label={t("mobileSheets.selectMemo")}
+ onClick={onEnterSelectionMode}
+ />
+ <div className="my-2 h-px bg-slate-100" />
+ </>
+ )}
+
+ <div className="px-3 py-2 text-xs font-semibold text-slate-400">{t("mobileSheets.displayMode")}</div>
+ <ToggleGroup
+ className="flex-col items-stretch"
+ type="single"
+ value={listDensity}
+ onValueChange={(value) => {
+ if (value) {
+ onListDensityChange(value as MemoListDensity);
+ }
+ }}
+ >
+ {memoListDensityOptions.map((option) => (
+ <ToggleGroupItem
+ key={option.value}
+ className="h-11 w-full justify-start gap-3 rounded-md px-3 text-left text-sm data-[state=on]:bg-emerald-50 data-[state=on]:text-emerald-700"
+ size="default"
+ value={option.value}
+ aria-label={option.label}
+ >
+ <span className={listDensity === option.value ? "text-emerald-500" : "text-slate-500"}>{option.icon}</span>
+ <span className="min-w-0 flex-1 truncate">{option.label}</span>
+ <CheckCircleCheck className={cn("h-4 w-4 shrink-0", listDensity === option.value ? "text-emerald-500" : "text-transparent")} />
+ </ToggleGroupItem>
+ ))}
+ </ToggleGroup>
- <div className="px-3 py-2 text-xs font-semibold text-slate-400">显示方式</div>
- <ToggleGroup
- className="flex-col items-stretch"
- type="single"
- value={listDensity}
- onValueChange={(value) => {
- if (value) {
- onListDensityChange(value as MemoListDensity);
- }
- }}
- >
- {memoListDensityOptions.map((option) => (
- <ToggleGroupItem
+ <div className="my-2 h-px bg-slate-100" />
+ <div className="px-3 py-2 text-xs font-semibold text-slate-400">{t("mobileSheets.sortMode")}</div>
+ {mobileSortOptions.map((option) => (
+ <button
key={option.value}
- className="h-11 w-full justify-start gap-3 rounded-md px-3 text-left text-sm data-[state=on]:bg-emerald-50 data-[state=on]:text-emerald-700"
- size="default"
- value={option.value}
- aria-label={option.label}
+ className={cn(
+ "flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium transition",
+ sortMode === option.value ? "bg-emerald-50 text-emerald-700" : "text-slate-800 hover:bg-slate-50"
+ )}
+ type="button"
+ aria-pressed={sortMode === option.value}
+ onClick={() => onSortModeChange(option.value)}
>
- <span className={listDensity === option.value ? "text-emerald-500" : "text-slate-500"}>{option.icon}</span>
<span className="min-w-0 flex-1 truncate">{option.label}</span>
- <CheckCircleCheck className={cn("h-4 w-4 shrink-0", listDensity === option.value ? "text-emerald-500" : "text-transparent")} />
- </ToggleGroupItem>
+ <CheckCircleCheck className={cn("h-4 w-4 shrink-0", sortMode === option.value ? "text-emerald-500" : "text-transparent")} />
+ </button>
))}
- </ToggleGroup>
-
- <div className="my-2 h-px bg-slate-100" />
- <div className="px-3 py-2 text-xs font-semibold text-slate-400">排序方式</div>
- {mobileSortOptions.map((option) => (
- <button
- key={option.value}
- className={cn(
- "flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium transition",
- sortMode === option.value ? "bg-emerald-50 text-emerald-700" : "text-slate-800 hover:bg-slate-50"
- )}
- type="button"
- aria-pressed={sortMode === option.value}
- onClick={() => onSortModeChange(option.value)}
- >
- <span className="min-w-0 flex-1 truncate">{option.label}</span>
- <CheckCircleCheck className={cn("h-4 w-4 shrink-0", sortMode === option.value ? "text-emerald-500" : "text-transparent")} />
- </button>
- ))}
- <div className="my-2 h-px bg-slate-100" />
- <MobileListActionButton icon={<Tags className="h-4 w-4" />} label="标签" onClick={onOpenTags} />
- <MobileListActionButton icon={<Archive className="h-4 w-4" />} label="附件" onClick={onOpenAssets} />
- {view === "trash" ? (
- <MobileListActionButton icon={<Trash2 className="h-4 w-4" />} label="清空回收站" onClick={onEmptyTrash} />
- ) : (
- <MobileListActionButton icon={<Trash2 className="h-4 w-4" />} label="回收站" onClick={onOpenTrash} />
- )}
- <MobileListActionButton icon={<KeyRound className="h-4 w-4" />} label="MCP Token" onClick={onOpenSettings} />
- </div>
- </DrawerContent>
- </Drawer>
-);
+ <div className="my-2 h-px bg-slate-100" />
+ <MobileListActionButton icon={<Tags className="h-4 w-4" />} label={t("mobileSheets.tags")} onClick={onOpenTags} />
+ <MobileListActionButton icon={<Archive className="h-4 w-4" />} label={t("mobileSheets.assets")} onClick={onOpenAssets} />
+ {view === "trash" ? (
+ <MobileListActionButton icon={<Trash2 className="h-4 w-4" />} label={t("mobileSheets.emptyTrash")} onClick={onEmptyTrash} />
+ ) : (
+ <MobileListActionButton icon={<Trash2 className="h-4 w-4" />} label={t("mobileSheets.trash")} onClick={onOpenTrash} />
+ )}
+ <MobileListActionButton icon={<KeyRound className="h-4 w-4" />} label="MCP Token" onClick={onOpenSettings} />
+ </div>
+ </DrawerContent>
+ </Drawer>
+ );
+};
export const MobileMoveSheet = ({
isMoving,
@@ -197,9 +201,10 @@ export const MobileMoveSheet = ({
onClose: () => void;
onMove: (notebookId: string) => void;
}) => {
+ const { t } = useTranslation();
const listRef = useRef<HTMLDivElement | null>(null);
const options = useMemo(() => getNotebookMoveOptions(notebooks), [notebooks]);
- const selectedCountLabel = getSelectionCountLabel(selectedCount);
+ const selectedCountLabel = selectedCount > 0 ? t("mobileSheets.selectionCount", { count: selectedCount }) : t("mobileSheets.selectMemo");
useEffect(() => {
window.setTimeout(() => {
@@ -215,17 +220,17 @@ export const MobileMoveSheet = ({
<DrawerContent className="bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md lg:hidden">
<header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
<DrawerHeader className="min-w-0 p-0">
- <DrawerTitle className="truncate">移动到笔记本</DrawerTitle>
+ <DrawerTitle className="truncate">{t("mobileSheets.moveToNotebook")}</DrawerTitle>
<DrawerDescription className="truncate">{selectedCountLabel}</DrawerDescription>
</DrawerHeader>
- <Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
+ <Button size="icon" variant="ghost" title={t("common.close")} aria-label={t("common.close")} onClick={onClose}>
<X className="h-4 w-4" />
</Button>
</header>
<Command className="min-h-0 flex-1">
- <CommandInput placeholder="搜索笔记本" />
+ <CommandInput placeholder={t("mobileSheets.searchNotebook")} />
<CommandList ref={listRef} className="max-h-[calc(100dvh_-_13.75rem_-_env(safe-area-inset-bottom))] p-2">
- <CommandEmpty>没有找到笔记本</CommandEmpty>
+ <CommandEmpty>{t("mobileSheets.noNotebookFound")}</CommandEmpty>
<CommandGroup>
{options.map((option) => {
const selected = option.id === selectedNotebookId;
@@ -240,7 +245,7 @@ export const MobileMoveSheet = ({
value={option.id}
keywords={[option.name, option.selectLabel, option.slug ?? ""]}
data-mobile-move-notebook-id={option.id}
- aria-label={selected ? `当前目标:${option.name}` : `移动到 ${option.name}`}
+ aria-label={selected ? t("mobileSheets.currentTarget", { name: option.name }) : t("mobileSheets.moveTo", { name: option.name })}
aria-current={selected ? "page" : undefined}
disabled={isMoving}
onSelect={() => onMove(option.id)}
@@ -289,15 +294,19 @@ export const MobileSelectionMoreSheet = ({
onMerge: () => void;
onPin: () => void;
onToggleVisibleSelection: () => void;
-}) => (
- <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
+}) => {
+ const { t } = useTranslation();
+ const selectedCountLabel = selectedCount > 0 ? t("mobileSheets.selectionCount", { count: selectedCount }) : t("mobileSheets.selectMemo");
+
+ return (
+ <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
<DrawerContent className="bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md lg:hidden">
<header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
<DrawerHeader className="min-w-0 p-0">
- <DrawerTitle className="truncate">批量操作</DrawerTitle>
- <DrawerDescription className="truncate">{getSelectionCountLabel(selectedCount)}</DrawerDescription>
+ <DrawerTitle className="truncate">{t("mobileSheets.bulkActions")}</DrawerTitle>
+ <DrawerDescription className="truncate">{selectedCountLabel}</DrawerDescription>
</DrawerHeader>
- <Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
+ <Button size="icon" variant="ghost" title={t("common.close")} aria-label={t("common.close")} onClick={onClose}>
<X className="h-4 w-4" />
</Button>
</header>
@@ -319,7 +328,7 @@ export const MobileSelectionMoreSheet = ({
onClick={onMerge}
>
<Merge className="h-4 w-4" />
- 合并笔记
+ {t("mobileSheets.mergeMemos")}
</button>
<button
className="flex h-12 w-full items-center gap-3 border-b border-slate-100 px-4 text-left text-sm font-medium text-slate-800 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:text-slate-300 disabled:opacity-100 disabled:hover:bg-transparent"
@@ -334,13 +343,14 @@ export const MobileSelectionMoreSheet = ({
<button
className="flex h-12 w-full items-center gap-3 px-4 text-left text-sm font-medium text-slate-800 transition hover:bg-slate-50"
type="button"
- title="取消选择"
- aria-label="取消选择"
+ title={t("mobileSheets.clearSelection")}
+ aria-label={t("mobileSheets.clearSelection")}
onClick={onClearSelection}
>
<X className="h-4 w-4" />
- 取消选择
+ {t("mobileSheets.clearSelection")}
</button>
</DrawerContent>
- </Drawer>
-);
+ </Drawer>
+ );
+};
diff --git a/apps/web/src/components/MemoListPane.tsx b/apps/web/src/components/MemoListPane.tsx
index cece830e..02c72ea0 100644
--- a/apps/web/src/components/MemoListPane.tsx
+++ b/apps/web/src/components/MemoListPane.tsx
@@ -9,6 +9,7 @@ import {
type KeyboardEvent as ReactKeyboardEvent,
type ReactNode,
} from "react";
+import { useTranslation } from "react-i18next";
import {
X,
ChevronLeft,
@@ -59,8 +60,8 @@ import type {
} from "@/lib/app-helpers";
import type { SyncQueueSummary } from "@/lib/sync-queue";
import {
- MEMO_FILTER_OPTIONS,
- MEMO_SORT_OPTIONS,
+ getMemoFilterOptions,
+ getMemoSortOptions,
getNotebookMoveOptions,
readMemoListDensityPreference,
writeMemoListDensityPreference,
@@ -78,7 +79,8 @@ const MobileSelectionMoreSheet = lazy(() =>
import("./MemoListMobileSheets").then((module) => ({ default: module.MobileSelectionMoreSheet }))
);
-const getSelectionCountLabel = (count: number) => (count > 0 ? `已选择 ${count} 条` : "选择笔记");
+const getSelectionCountLabel = (count: number, t: ReturnType<typeof useTranslation>["t"]) =>
+ count > 0 ? t("memoList.selectionCount", { count }) : t("memoList.selectMemo");
export const MemoSelectionActionBar = ({
deleteTitle,
@@ -122,19 +124,22 @@ export const MemoSelectionActionBar = ({
pinTitle: string;
selectedCount: number;
onMoveTargetChange: (notebookId: string) => void;
-}) => (
+}) => {
+ const { t } = useTranslation();
+
+ return (
<div className="hidden h-full min-h-0 flex-1 items-center justify-start bg-white px-16 py-10 lg:flex xl:px-24">
<div className="w-72 overflow-hidden rounded-md border border-slate-200 bg-white py-1 shadow-lg">
<div className="flex h-9 items-center gap-2 px-3 text-xs font-semibold text-slate-400">
<CheckSquare className="h-4 w-4" />
- {getSelectionCountLabel(selectedCount)}
+ {getSelectionCountLabel(selectedCount, t)}
</div>
{!isTrashView && moveNotebookOptions.length > 0 && (
<div className="border-t border-slate-100 px-3 py-2">
<div className="flex items-center gap-2">
<Select value={moveTargetNotebookId} disabled={isMoving} onValueChange={onMoveTargetChange}>
<SelectTrigger className="h-8 min-w-0 flex-1 text-xs text-slate-700 border-slate-200">
- <SelectValue placeholder="选择笔记本" />
+ <SelectValue placeholder={t("memoList.chooseNotebook")} />
</SelectTrigger>
<SelectContent className="max-h-60 bg-white border border-slate-200 rounded-md py-1 shadow-md">
{moveNotebookOptions.map((item) => (
@@ -152,7 +157,7 @@ export const MemoSelectionActionBar = ({
disabled={selectedCount === 0 || !moveTargetNotebookId || isMoving || isTrashView}
>
<Folder className="h-4 w-4" />
- 移动
+ {t("memoList.move")}
</Button>
</div>
</div>
@@ -175,7 +180,7 @@ export const MemoSelectionActionBar = ({
disabled={selectedCount < 2 || isMerging || isTrashView}
>
<Merge className="h-4 w-4" />
- 合并笔记
+ {t("memoList.mergeMemos")}
</Button>
<div className="h-px bg-slate-100" />
<Button
@@ -186,21 +191,22 @@ export const MemoSelectionActionBar = ({
disabled={selectedCount === 0 || isDeleting}
>
<Trash2 className="h-4 w-4" />
- {isTrashView ? "永久删除" : "删除"}
+ {isTrashView ? t("memoList.permanentDelete") : t("common.delete")}
</Button>
<div className="h-px bg-slate-100" />
<Button
className="h-11 w-full justify-start rounded-none px-3 text-slate-700 hover:bg-slate-50"
variant="ghost"
- title="取消选择"
+ title={t("memoList.clearSelection")}
onClick={onClearSelection}
>
<X className="h-4 w-4" />
- 取消选择
+ {t("memoList.clearSelection")}
</Button>
</div>
</div>
-);
+ );
+};
const getMobileFilterIcon = (filterMode: MemoFilterMode) => {
if (filterMode === "tagged") {
@@ -259,30 +265,34 @@ const MobileSelectionActionBar = ({
onDelete: () => void;
onOpenMore: () => void;
onOpenMove: () => void;
-}) => (
- <nav
- className="fixed inset-x-0 bottom-0 z-40 border-t border-slate-200 bg-white/95 px-8 pb-[max(0.125rem,env(safe-area-inset-bottom))] pt-1 shadow-[0_-10px_30px_rgba(15,23,42,0.08)] backdrop-blur lg:hidden"
- aria-label="批量操作"
- >
- <div className="grid h-14 grid-cols-3 items-center">
- <MobileSelectionActionButton
- disabled={!canMove}
- icon={<Folder className="h-5 w-5" />}
- label="移动"
- title={moveTitle}
- onClick={onOpenMove}
- />
- <MobileSelectionActionButton
- disabled={!canDelete}
- icon={<Trash2 className="h-5 w-5" />}
- label={isTrashView ? "永久删除" : "删除"}
- title={deleteTitle}
- onClick={onDelete}
- />
- <MobileSelectionActionButton icon={<MoreVertical className="h-5 w-5" />} label="更多" onClick={onOpenMore} />
- </div>
- </nav>
-);
+}) => {
+ const { t } = useTranslation();
+
+ return (
+ <nav
+ className="fixed inset-x-0 bottom-0 z-40 border-t border-slate-200 bg-white/95 px-8 pb-[max(0.125rem,env(safe-area-inset-bottom))] pt-1 shadow-[0_-10px_30px_rgba(15,23,42,0.08)] backdrop-blur lg:hidden"
+ aria-label={t("mobileSheets.bulkActions")}
+ >
+ <div className="grid h-14 grid-cols-3 items-center">
+ <MobileSelectionActionButton
+ disabled={!canMove}
+ icon={<Folder className="h-5 w-5" />}
+ label={t("workspace.selection.move")}
+ title={moveTitle}
+ onClick={onOpenMove}
+ />
+ <MobileSelectionActionButton
+ disabled={!canDelete}
+ icon={<Trash2 className="h-5 w-5" />}
+ label={isTrashView ? t("workspace.selection.permanentDelete") : t("workspace.selection.delete")}
+ title={deleteTitle}
+ onClick={onDelete}
+ />
+ <MobileSelectionActionButton icon={<MoreVertical className="h-5 w-5" />} label={t("mobileSheets.more")} onClick={onOpenMore} />
+ </div>
+ </nav>
+ );
+};
const CheckCircleCheck = ({ className }: { className?: string }) => (
<svg
@@ -427,13 +437,15 @@ export const MemoListPane = ({
setDesktopActionsOpen: (open: boolean) => void;
onRetry: () => void;
}) => {
+ const { t } = useTranslation();
const [memoContextMenu, setMemoContextMenu] = useState<MemoContextMenuState | null>(null);
const [contextMoveOpen, setContextMoveOpen] = useState(false);
const [listDensity, setListDensity] = useState<MemoListDensity>(() => readMemoListDensityPreference());
const [lastSelectedMemoId, setLastSelectedMemoId] = useState<string | null>(null);
const [moveTargetNotebookId, setMoveTargetNotebookId] = useState("");
- const filterOptions = MEMO_FILTER_OPTIONS;
+ const filterOptions = useMemo(() => getMemoFilterOptions(t), [t]);
+ const memoSortOptions = useMemo(() => getMemoSortOptions(t), [t]);
const mobileFilterOptions = useMemo(() => filterOptions.filter((option: any) => option.value !== "all"), [filterOptions]);
const visibleMemoIds = useMemo(() => memos.map((memo) => memo.id), [memos]);
const moveNotebookOptions = useMemo(() => getNotebookMoveOptions(notebooks), [notebooks]);
@@ -451,46 +463,47 @@ export const MemoListPane = ({
const selectedVisibleMemoCount = visibleMemoIds.filter((memoId) => selectedMemoIds.has(memoId)).length;
const allVisibleMemosSelected = visibleMemoIds.length > 0 && selectedVisibleMemoCount === visibleMemoIds.length;
const canToggleVisibleMemoSelection = visibleMemoIds.length > 0;
- const visibleSelectionToggleLabel = allVisibleMemosSelected ? "全不选当前列表" : "全选当前列表";
+ const visibleSelectionToggleLabel = allVisibleMemosSelected ? t("memoList.selectedListNone") : t("memoList.selectedListAll");
- const listTitle = view === "trash" ? "回收站" : notebook?.name ?? "全部笔记";
- const listContextLabel = view === "trash" ? "已删除笔记" : notebook ? "当前笔记本" : "所有笔记本";
- const listCountLabel = `${memos.length}${memos.length !== totalMemoCount ? ` / ${totalMemoCount}` : ""} ${
- view === "trash" ? "条已删除" : "条笔记"
- }`;
- const selectionCountLabel = getSelectionCountLabel(selectedMemoIds.size);
+ const listTitle = view === "trash" ? t("memoList.trash") : notebook?.name ?? t("memoList.allMemos");
+ const listContextLabel = view === "trash" ? t("memoList.deletedMemos") : notebook ? t("memoList.currentNotebook") : t("memoList.allNotebooks");
+ const visibleCount = `${memos.length}${memos.length !== totalMemoCount ? ` / ${totalMemoCount}` : ""}`;
+ const listCountLabel = view === "trash"
+ ? t("memoList.deletedCount", { count: visibleCount })
+ : t("memoList.memoCount", { count: visibleCount });
+ const selectionCountLabel = getSelectionCountLabel(selectedMemoIds.size, t);
const selectionMoveTitle =
selectedMemoIds.size === 0
- ? "请选择笔记"
+ ? t("workspace.selection.chooseMemo")
: view === "trash"
- ? "回收站内不可移动"
+ ? t("workspace.selection.trashCannotMove")
: notebooks.length === 0
- ? "没有可移动的笔记本"
+ ? t("workspace.selection.noMovableNotebook")
: isMoving
- ? "正在移动"
- : "移动";
+ ? t("workspace.selection.moving")
+ : t("workspace.selection.move");
const selectionDeleteTitle =
- selectedMemoIds.size === 0 ? "请选择笔记" : isDeleting ? "正在删除" : view === "trash" ? "永久删除" : "删除";
+ selectedMemoIds.size === 0 ? t("workspace.selection.chooseMemo") : isDeleting ? t("workspace.selection.deleting") : view === "trash" ? t("workspace.selection.permanentDelete") : t("workspace.selection.delete");
const selectionMergeTitle =
- selectedMemoIds.size < 2 ? "至少选择 2 条笔记" : view === "trash" ? "回收站内不可合并" : isMerging ? "正在合并" : "合并笔记";
+ selectedMemoIds.size < 2 ? t("workspace.selection.needTwoMemos") : view === "trash" ? t("workspace.selection.trashCannotMerge") : isMerging ? t("workspace.selection.merging") : t("workspace.selection.merge");
const allSelectedMemosPinned = selectedMemosInList.length > 0 && selectedMemosInList.every((memo) => memo.isPinned);
const selectedPinTarget = !allSelectedMemosPinned;
- const selectionPinLabel = allSelectedMemosPinned ? "取消置顶" : "置顶";
+ const selectionPinLabel = allSelectedMemosPinned ? t("workspace.selection.unpin") : t("workspace.selection.pin");
const selectionPinTitle =
selectedMemoIds.size === 0
- ? "请选择笔记"
+ ? t("workspace.selection.chooseMemo")
: view === "trash"
- ? "回收站内不可置顶"
+ ? t("workspace.selection.trashCannotPin")
: isPinning
- ? "正在更新置顶"
+ ? t("workspace.selection.updatingPin")
: selectionPinLabel;
- const selectionToggleTitle = canToggleVisibleMemoSelection ? visibleSelectionToggleLabel : "当前列表没有可选择的笔记";
+ const selectionToggleTitle = canToggleVisibleMemoSelection ? visibleSelectionToggleLabel : t("memoList.noSelectableInList");
const moveTargetTitle =
- view === "trash" ? "回收站内不可移动" : notebooks.length === 0 ? "没有可移动的笔记本" : isMoving ? "正在移动" : "移动到笔记本";
+ view === "trash" ? t("workspace.selection.trashCannotMove") : notebooks.length === 0 ? t("workspace.selection.noMovableNotebook") : isMoving ? t("workspace.selection.moving") : t("memoList.moveToNotebook");
const hasListConstraint = Boolean(search.trim()) || filterMode !== "all";
- const activeFilterLabel = filterOptions.find((option) => option.value === filterMode)?.label ?? "全部";
- const activeSortLabel = MEMO_SORT_OPTIONS.find((option) => option.value === sortMode)?.label ?? "最近更新";
+ const activeFilterLabel = filterOptions.find((option) => option.value === filterMode)?.label ?? t("options.memoFilter.all");
+ const activeSortLabel = memoSortOptions.find((option) => option.value === sortMode)?.label ?? t("options.memoSort.updatedDesc");
useEffect(() => {
if (notebook?.id) {
@@ -878,8 +891,8 @@ export const MemoListPane = ({
<button
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-slate-500 transition hover:bg-slate-100 hover:text-slate-900"
type="button"
- title="取消选择"
- aria-label="取消选择"
+ title={t("memoList.clearSelection")}
+ aria-label={t("memoList.clearSelection")}
onClick={onClearSelection}
>
<X className="h-5 w-5" />
@@ -891,8 +904,8 @@ export const MemoListPane = ({
<button
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-slate-500 transition hover:bg-slate-100 hover:text-slate-900"
type="button"
- title="退出搜索"
- aria-label="退出搜索"
+ title={t("memoList.cancelSearch")}
+ aria-label={t("memoList.cancelSearch")}
onClick={onCancelMobileSearch}
>
<ChevronLeft className="h-5 w-5" />
@@ -922,14 +935,14 @@ export const MemoListPane = ({
onCancelMobileSearch();
}}
className="min-w-0 flex-1 bg-transparent text-slate-900 outline-none placeholder:text-slate-400"
- placeholder="搜索笔记"
+ placeholder={t("memoList.searchPlaceholder")}
/>
{search && (
<button
className="flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
type="button"
- title="清空搜索"
- aria-label="清空搜索"
+ title={t("memoList.clearSearch")}
+ aria-label={t("memoList.clearSearch")}
onMouseDown={(event) => event.preventDefault()}
onClick={handleClearSearch}
>
@@ -942,7 +955,7 @@ export const MemoListPane = ({
type="button"
onClick={onCancelMobileSearch}
>
- 取消
+ {t("memoList.cancel")}
</button>
</div>
) : null}
@@ -953,8 +966,8 @@ export const MemoListPane = ({
<button
className="flex min-w-0 items-center gap-1 rounded-md px-1 py-1 text-left transition hover:bg-slate-100 lg:hidden"
type="button"
- title="切换笔记本"
- aria-label="切换笔记本"
+ title={t("memoList.switchNotebook")}
+ aria-label={t("memoList.switchNotebook")}
onClick={onOpenNotebookPicker}
>
<span className="max-w-[190px] truncate text-lg font-semibold text-slate-950">{listTitle}</span>
@@ -964,8 +977,8 @@ export const MemoListPane = ({
<button
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-slate-600 transition hover:bg-slate-100 hover:text-slate-900"
type="button"
- title={selectionMode ? "批量操作" : "列表选项"}
- aria-label={selectionMode ? "批量操作" : "列表选项"}
+ title={selectionMode ? t("memoList.bulkActions") : t("memoList.listOptions")}
+ aria-label={selectionMode ? t("memoList.bulkActions") : t("memoList.listOptions")}
aria-expanded={selectionMode ? mobileMoreOpen : mobileListActionsOpen}
onClick={() => {
if (selectionMode) {
@@ -992,8 +1005,8 @@ export const MemoListPane = ({
<Button
size="icon"
variant="ghost"
- title="选择笔记"
- aria-label="选择笔记"
+ title={t("memoList.selectMemo")}
+ aria-label={t("memoList.selectMemo")}
onClick={onEnterSelectionMode}
disabled={!canEnterSelectionMode}
>
@@ -1008,7 +1021,7 @@ export const MemoListPane = ({
? "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 hover:text-slate-900"
: "border-slate-300 bg-slate-100 text-slate-900 hover:bg-slate-200"
)}
- title={`筛选:${activeFilterLabel}`}
+ title={t("memoList.filterTitle", { label: activeFilterLabel })}
>
{getMobileFilterIcon(filterMode)}
</button>
@@ -1034,13 +1047,13 @@ export const MemoListPane = ({
<DropdownMenuTrigger asChild>
<button
className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-slate-200 bg-white text-xs font-medium text-slate-600 transition hover:bg-slate-50 hover:text-slate-900 outline-none"
- title={`排序:${activeSortLabel}`}
+ title={t("memoList.sortTitle", { label: activeSortLabel })}
>
<ArrowDownWideNarrow className="h-4 w-4" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="w-44 bg-white border border-slate-200 rounded-md py-1 shadow-md">
- {MEMO_SORT_OPTIONS.map((option: any) => (
+ {memoSortOptions.map((option: any) => (
<DropdownMenuItem
key={option.value}
className={cn(
@@ -1068,18 +1081,18 @@ export const MemoListPane = ({
<ToggleGroupItem
className="rounded-none border-0"
size="icon"
- title="预览列表"
+ title={t("memoList.previewList")}
value="preview"
- aria-label="预览列表"
+ aria-label={t("memoList.previewList")}
>
<LayoutList className="h-4 w-4" />
</ToggleGroupItem>
<ToggleGroupItem
className="rounded-none border-0 border-l border-slate-200"
size="icon"
- title="紧凑列表"
+ title={t("memoList.compactList")}
value="compact"
- aria-label="紧凑列表"
+ aria-label={t("memoList.compactList")}
>
<List className="h-4 w-4" />
</ToggleGroupItem>
@@ -1090,11 +1103,11 @@ export const MemoListPane = ({
<Button
size="sm"
variant="danger"
- title="清空回收站,不可恢复"
+ title={t("memoList.emptyTrashTitle")}
onClick={onEmptyTrash}
>
<Trash2 className="h-4 w-4" />
- 清空
+ {t("memoList.emptyTrash")}
</Button>
)}
<DropdownMenu>
@@ -1102,8 +1115,8 @@ export const MemoListPane = ({
<Button
size="icon"
variant="ghost"
- title="更多"
- aria-label="列表更多操作"
+ title={t("memoList.more")}
+ aria-label={t("memoList.moreActions")}
>
<MoreHorizontal className="h-4 w-4" />
</Button>
@@ -1114,21 +1127,21 @@ export const MemoListPane = ({
onClick={onOpenTags}
>
<Tags className="h-4 w-4 text-slate-500" />
- 标签
+ {t("memoList.tags")}
</DropdownMenuItem>
<DropdownMenuItem
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"
onClick={onOpenAssets}
>
<Archive className="h-4 w-4 text-slate-500" />
- 附件
+ {t("memoList.assets")}
</DropdownMenuItem>
<DropdownMenuItem
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"
onClick={view === "trash" ? onEmptyTrash : onOpenTrash}
>
<Trash2 className="h-4 w-4 text-rose-700" />
- {view === "trash" ? "清空回收站" : "回收站"}
+ {view === "trash" ? t("memoList.emptyTrash") : t("memoList.trash")}
</DropdownMenuItem>
<DropdownMenuItem
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"
@@ -1162,14 +1175,14 @@ export const MemoListPane = ({
}
}}
className="min-w-0 flex-1 bg-transparent text-slate-900 outline-none placeholder:text-slate-400"
- placeholder="搜索笔记"
+ placeholder={t("memoList.searchPlaceholder")}
/>
{search && (
<button
className="flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-white hover:text-slate-700"
type="button"
- title="清空搜索"
- aria-label="清空搜索"
+ title={t("memoList.clearSearch")}
+ aria-label={t("memoList.clearSearch")}
onMouseDown={(event) => event.preventDefault()}
onClick={handleClearSearch}
>
@@ -1188,8 +1201,8 @@ export const MemoListPane = ({
: "border-slate-200 bg-white text-slate-500 hover:bg-slate-50 hover:text-slate-800"
)}
type="button"
- title={filterMode === option.value ? `取消${option.label}` : option.label}
- aria-label={filterMode === option.value ? `取消${option.label}` : option.label}
+ title={filterMode === option.value ? t("memoList.toggleOffFilter", { label: option.label }) : option.label}
+ aria-label={filterMode === option.value ? t("memoList.toggleOffFilter", { label: option.label }) : option.label}
aria-pressed={filterMode === option.value}
onClick={() => handleFilterModeChange(filterMode === option.value ? "all" : option.value)}
>
@@ -1202,14 +1215,19 @@ export const MemoListPane = ({
{hasListConstraint && (
<div className="mt-3 flex min-h-8 items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 text-xs text-slate-500">
<span className="min-w-0 flex-1 truncate">
- {search.trim() ? `搜索「${search.trim()}」` : `筛选:${activeFilterLabel}`} · {totalMemoCount} 条
+ {t("memoList.constrainedCount", {
+ label: search.trim()
+ ? t("memoList.searchConstraint", { query: search.trim() })
+ : t("memoList.filterConstraint", { label: activeFilterLabel }),
+ count: totalMemoCount,
+ })}
</span>
<button
className="shrink-0 font-semibold text-slate-600 transition hover:text-slate-950"
type="button"
onClick={handleResetListConstraints}
>
- 重置
+ {t("memoList.reset")}
</button>
</div>
)}
@@ -1220,34 +1238,34 @@ export const MemoListPane = ({
className="relative min-h-0 flex-1 overflow-y-auto p-3 pb-[calc(7rem+env(safe-area-inset-bottom))] lg:pb-3"
>
{isLoading || (isRefreshing && memos.length === 0) ? (
- <div className="px-2 py-4 text-sm text-slate-500">正在拉取最新笔记</div>
+ <div className="px-2 py-4 text-sm text-slate-500">{t("memoList.fetchingLatest")}</div>
) : isError && memos.length === 0 ? (
<div className="rounded-md border border-dashed border-amber-300 bg-amber-50 px-4 py-9 text-center">
- <div className="text-sm font-semibold text-amber-950">暂时没有拉到笔记</div>
+ <div className="text-sm font-semibold text-amber-950">{t("memoList.fetchEmptyTitle")}</div>
<div className="mx-auto mt-2 max-w-[280px] text-xs leading-5 text-amber-800">
- 网络或 PWA 后台恢复可能短暂中断了同步。这里不会把它当作空笔记本。
+ {t("memoList.fetchEmptyDescription")}
</div>
<Button className="mt-4 justify-center" size="sm" variant="soft" onClick={onRetry}>
<RotateCcw className="h-4 w-4" />
- 重新拉取
+ {t("memoList.retry")}
</Button>
</div>
) : memos.length === 0 ? (
<div className="rounded-md border border-dashed border-slate-300 bg-white px-4 py-9 text-center">
<div className="text-sm font-semibold text-slate-800">
- {memos.length === 0 ? (view === "trash" ? "回收站为空" : "暂无笔记") : "没有符合筛选的笔记"}
+ {memos.length === 0 ? (view === "trash" ? t("memoList.trashEmptyTitle") : t("memoList.emptyTitle")) : t("memoList.noFilteredTitle")}
</div>
<div className="mx-auto mt-2 max-w-[260px] text-xs leading-5 text-slate-500">
{memos.length === 0
? view === "trash"
- ? "删除的笔记会显示在这里。"
- : "先创建一条笔记,之后可以在这里快速预览、搜索和批量整理。"
- : "试试切换筛选条件,或调整搜索关键词。"}
+ ? t("memoList.trashEmptyDescription")
+ : t("memoList.emptyDescription")
+ : t("memoList.noFilteredDescription")}
</div>
{memos.length === 0 && canCreateMemo && view !== "trash" && (
<Button className="mt-4 justify-center" size="sm" variant="solid" onClick={onCreateMemo} disabled={isCreating}>
<FilePlus2 className="h-4 w-4" />
- 新建笔记
+ {t("memoList.newMemo")}
</Button>
)}
</div>
@@ -1278,7 +1296,7 @@ export const MemoListPane = ({
</div>
{isLoadingMoreMemos && (
<div className="border-t border-slate-100 px-4 py-3 text-center text-xs font-medium text-slate-500">
- 正在加载更多笔记
+ {t("memoList.loadingMore")}
</div>
)}
</div>
@@ -1302,7 +1320,7 @@ export const MemoListPane = ({
}}
>
<FileIcon className="h-4 w-4" />
- 打开笔记
+ {t("memoList.openMemo")}
</DropdownMenuItem>
<DropdownMenuItem
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"
@@ -1313,7 +1331,7 @@ export const MemoListPane = ({
}}
>
<CheckSquare className="h-4 w-4" />
- 选择笔记
+ {t("memoList.selectMemo")}
</DropdownMenuItem>
{view !== "trash" && (
<DropdownMenuItem
@@ -1326,7 +1344,7 @@ export const MemoListPane = ({
}}
>
<Star className={cn("h-4 w-4", memoContextMenu.memo.isPinned && "fill-current text-slate-700")} />
- {memoContextMenu.memo.isPinned ? "取消置顶" : "置顶笔记"}
+ {memoContextMenu.memo.isPinned ? t("memoList.unpin") : t("memoList.pinMemo")}
</DropdownMenuItem>
)}
<DropdownMenuSeparator className="my-1 h-px bg-slate-100" />
@@ -1341,7 +1359,7 @@ export const MemoListPane = ({
}}
>
<RotateCcw className="h-4 w-4" />
- 恢复笔记
+ {t("memoList.restoreMemo")}
</DropdownMenuItem>
<DropdownMenuItem
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-rose-700 hover:bg-rose-50 cursor-pointer outline-none"
@@ -1352,7 +1370,7 @@ export const MemoListPane = ({
}}
>
<Trash2 className="h-4 w-4" />
- 永久删除
+ {t("memoList.permanentDelete")}
</DropdownMenuItem>
</>
) : (
@@ -1363,7 +1381,7 @@ export const MemoListPane = ({
onClick={() => setContextMoveOpen((value) => !value)}
>
<Folder className="h-4 w-4" />
- <span className="min-w-0 flex-1 truncate">移动到笔记本</span>
+ <span className="min-w-0 flex-1 truncate">{t("memoList.moveToNotebook")}</span>
<ChevronRight className={cn("h-4 w-4 transition-transform duration-200", contextMoveOpen && "rotate-90")} />
</DropdownMenuItem>
{contextMoveOpen && (
@@ -1400,7 +1418,7 @@ export const MemoListPane = ({
}}
>
<Trash2 className="h-4 w-4" />
- 删除笔记
+ {t("memoList.deleteMemo")}
</DropdownMenuItem>
</>
)}
diff --git a/apps/web/src/components/NotebookPane.tsx b/apps/web/src/components/NotebookPane.tsx
index 0bcd92e5..1188909e 100644
--- a/apps/web/src/components/NotebookPane.tsx
+++ b/apps/web/src/components/NotebookPane.tsx
@@ -1,5 +1,6 @@
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useQuery } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
import {
ChevronLeft,
Plus,
@@ -33,8 +34,8 @@ import type { Notebook, AuthUser } from "@edgeever/shared";
import type { NotebookNode, NotebookDropPosition, NotebookSortMode } from "@/lib/app-helpers";
import type { SyncQueueSummary } from "@/lib/sync-queue";
import {
- NOTEBOOK_SORT_OPTIONS,
buildNotebookTree,
+ getNotebookSortOptions,
getNotebookSortComparator,
hasEdgeEverDragData,
readNotebookSortPreference,
@@ -77,34 +78,38 @@ const SidebarTrashNavButton = ({
active?: boolean;
onOpenTrash: () => void;
onEmptyTrash: () => void;
-}) => (
- <div className="group relative">
- <button
- className={cn(
- "flex h-9 w-full items-center gap-3 rounded-md px-3 pr-16 text-left text-sm font-medium leading-none transition-all duration-200",
- active ? "bg-slate-100 text-slate-950" : "text-slate-700 hover:bg-slate-50 hover:text-slate-950"
- )}
- type="button"
- aria-current={active ? "page" : undefined}
- onClick={onOpenTrash}
- >
- <span className="flex h-4 w-4 shrink-0 items-center justify-center">
- <Trash2 className="h-4 w-4" />
- </span>
- <span className="min-w-0 flex-1 truncate">回收站</span>
- </button>
- <button
- className="pointer-events-none absolute right-1.5 top-1/2 flex h-7 -translate-y-1/2 items-center gap-1 rounded-md px-2 text-xs font-medium text-rose-700 opacity-0 transition-all duration-200 hover:bg-rose-50 focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-rose-400/70 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100"
- type="button"
- title="清空回收站"
- aria-label="清空回收站"
- onClick={onEmptyTrash}
- >
- <Trash2 className="h-3.5 w-3.5" />
- 清空
- </button>
- </div>
-);
+}) => {
+ const { t } = useTranslation();
+
+ return (
+ <div className="group relative">
+ <button
+ className={cn(
+ "flex h-9 w-full items-center gap-3 rounded-md px-3 pr-16 text-left text-sm font-medium leading-none transition-all duration-200",
+ active ? "bg-slate-100 text-slate-950" : "text-slate-700 hover:bg-slate-50 hover:text-slate-950"
+ )}
+ type="button"
+ aria-current={active ? "page" : undefined}
+ onClick={onOpenTrash}
+ >
+ <span className="flex h-4 w-4 shrink-0 items-center justify-center">
+ <Trash2 className="h-4 w-4" />
+ </span>
+ <span className="min-w-0 flex-1 truncate">{t("notebookPane.trash")}</span>
+ </button>
+ <button
+ className="pointer-events-none absolute right-1.5 top-1/2 flex h-7 -translate-y-1/2 items-center gap-1 rounded-md px-2 text-xs font-medium text-rose-700 opacity-0 transition-all duration-200 hover:bg-rose-50 focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-rose-400/70 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100"
+ type="button"
+ title={t("notebookPane.emptyTrash")}
+ aria-label={t("notebookPane.emptyTrash")}
+ onClick={onEmptyTrash}
+ >
+ <Trash2 className="h-3.5 w-3.5" />
+ {t("notebookPane.empty")}
+ </button>
+ </div>
+ );
+};
const SidebarSectionLabel = ({ icon, label }: { icon: ReactNode; label: string }) => (
<div className="flex h-9 items-center gap-3 px-3 text-sm font-medium leading-none text-slate-600">
@@ -113,28 +118,28 @@ const SidebarSectionLabel = ({ icon, label }: { icon: ReactNode; label: string }
</div>
);
-const getSyncStatusLabel = (summary: SyncQueueSummary, isOnline: boolean, isSyncing: boolean) => {
+const getSyncStatusLabel = (summary: SyncQueueSummary, isOnline: boolean, isSyncing: boolean, t: ReturnType<typeof useTranslation>["t"]) => {
if (!isOnline) {
- return summary.total > 0 ? `离线,${summary.total} 项待同步` : "离线";
+ return summary.total > 0 ? t("notebookPane.sync.offlineWithPending", { count: summary.total }) : t("notebookPane.sync.offline");
}
if (isSyncing || summary.syncing > 0) {
- return "同步中";
+ return t("notebookPane.sync.syncing");
}
if (summary.conflict > 0) {
- return `${summary.conflict} 项同步冲突`;
+ return t("notebookPane.sync.conflicts", { count: summary.conflict });
}
if (summary.error > 0) {
- return `${summary.error} 项等待重试`;
+ return t("notebookPane.sync.retry", { count: summary.error });
}
if (summary.pending > 0) {
- return `${summary.pending} 项待同步`;
+ return t("notebookPane.sync.pending", { count: summary.pending });
}
- return "已同步";
+ return t("notebookPane.sync.synced");
};
const SyncStatusBar = ({
@@ -148,8 +153,9 @@ const SyncStatusBar = ({
isSyncing: boolean;
onSyncNow: () => void;
}) => {
+ const { t } = useTranslation();
const hasQueuedWork = summary.total > 0;
- const label = getSyncStatusLabel(summary, isOnline, isSyncing);
+ const label = getSyncStatusLabel(summary, isOnline, isSyncing, t);
const statusClassName = !isOnline
? "border-slate-200 bg-slate-50 text-slate-600"
: summary.conflict > 0
@@ -174,8 +180,8 @@ const SyncStatusBar = ({
<button
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md hover:bg-white/70 disabled:opacity-50 transition-colors"
type="button"
- title="立即同步"
- aria-label="立即同步"
+ title={t("notebookPane.syncNow")}
+ aria-label={t("notebookPane.syncNow")}
disabled={!isOnline || isSyncing}
onClick={onSyncNow}
>
@@ -243,6 +249,7 @@ export const NotebookPane = ({
onLogout: () => void;
isLoggingOut: boolean;
}) => {
+ const { t } = useTranslation();
const notebookScrollRef = useRef<HTMLDivElement | null>(null);
const notebookDragScrollFrameRef = useRef<number | null>(null);
const [expandSiblingsRequest, setExpandSiblingsRequest] = useState<{ parentId: string | null; token: number } | null>(null);
@@ -309,9 +316,10 @@ export const NotebookPane = ({
});
const notebooks = notebooksQuery.data?.notebooks ?? [];
+ const notebookSortOptions = useMemo(() => getNotebookSortOptions(t), [t]);
const tree = useMemo(() => buildNotebookTree(notebooks, getNotebookSortComparator(notebookSortMode)), [notebooks, notebookSortMode]);
const isLoading = notebooksQuery.isLoading;
- const activeNotebookSortLabel = NOTEBOOK_SORT_OPTIONS.find((option) => option.value === notebookSortMode)?.label ?? "名称";
+ const activeNotebookSortLabel = notebookSortOptions.find((option) => option.value === notebookSortMode)?.label ?? t("options.notebookSort.nameAsc");
useEffect(() => {
writeNotebookSortPreference(notebookSortMode);
@@ -335,15 +343,15 @@ export const NotebookPane = ({
<div className="flex h-full min-h-0 flex-col">
<header className="flex h-[calc(4rem+env(safe-area-inset-top))] shrink-0 items-end justify-between border-b border-slate-200 px-4 pb-3 pt-[env(safe-area-inset-top)] lg:h-16 lg:items-center lg:pb-0 lg:pt-0">
<div>
- <div className="text-base font-semibold tracking-normal lg:hidden">笔记本</div>
+ <div className="text-base font-semibold tracking-normal lg:hidden">{t("notebookPane.notebooks")}</div>
<div className="hidden text-base font-semibold tracking-normal lg:block">EdgeEver</div>
- <div className="text-xs text-slate-500">{user?.username ?? "边缘笔记工作区"}</div>
+ <div className="text-xs text-slate-500">{user?.username ?? t("notebookPane.workspaceFallback")}</div>
</div>
<div className="flex items-center gap-1">
- <Button className="lg:hidden" size="icon" variant="ghost" title="返回笔记列表" aria-label="返回笔记列表" onClick={onBackToList}>
+ <Button className="lg:hidden" size="icon" variant="ghost" title={t("notebookPane.backToList")} aria-label={t("notebookPane.backToList")} onClick={onBackToList}>
<ChevronLeft className="h-4 w-4" />
</Button>
- <Button className="lg:hidden" size="icon" variant="ghost" title="新建笔记本" aria-label="新建笔记本" onClick={() => onCreateNotebook(null)}>
+ <Button className="lg:hidden" size="icon" variant="ghost" title={t("notebookPane.newNotebook")} aria-label={t("notebookPane.newNotebook")} onClick={() => onCreateNotebook(null)}>
<Plus className="h-4 w-4" />
</Button>
</div>
@@ -365,34 +373,34 @@ export const NotebookPane = ({
<button
className="flex h-14 min-w-0 flex-1 items-center gap-3 px-3 text-left transition-all duration-200 hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50"
type="button"
- title="新建笔记"
+ title={t("notebookPane.newMemo")}
onClick={onCreateMemo}
disabled={!canCreateMemo || isCreatingMemo}
>
<span className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-emerald-600 text-white shadow-[0_8px_18px_rgb(var(--brand-green-rgb)/0.28)] transition-transform duration-200 group-hover:scale-105">
<Plus className="h-6 w-6" />
</span>
- <span className="min-w-0 truncate text-sm font-semibold text-slate-950">新建笔记</span>
+ <span className="min-w-0 truncate text-sm font-semibold text-slate-950">{t("notebookPane.newMemo")}</span>
</button>
</div>
- <nav className="mb-3 space-y-1" aria-label="笔记入口">
+ <nav className="mb-3 space-y-1" aria-label={t("notebookPane.entries")}>
<SidebarNavButton
active={view === "notebook" && selectedNotebookId === null}
icon={<LayoutList className="h-4 w-4" />}
- label="全部笔记"
+ label={t("notebookPane.allMemos")}
onClick={onBackToList}
/>
</nav>
<div className="group mb-2 flex items-center justify-between gap-2">
- <SidebarSectionLabel icon={<NotebookIcon className="h-4 w-4" />} label="笔记本" />
+ <SidebarSectionLabel icon={<NotebookIcon className="h-4 w-4" />} label={t("notebookPane.notebooks")} />
<div className="flex items-center gap-1 opacity-100 transition-opacity duration-200 lg:opacity-0 lg:group-hover:opacity-100 lg:group-focus-within:opacity-100">
<button
className="flex h-6 w-6 items-center justify-center rounded-md text-slate-500 transition-colors duration-200 hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400/70"
type="button"
- title="新建笔记本"
- aria-label="新建笔记本"
+ title={t("notebookPane.newNotebook")}
+ aria-label={t("notebookPane.newNotebook")}
onClick={() => onCreateNotebook(null)}
>
<BookPlus className="h-3.5 w-3.5" />
@@ -402,14 +410,14 @@ export const NotebookPane = ({
<button
className="flex h-6 w-6 items-center justify-center rounded-md text-slate-500 transition-colors duration-200 hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400/70"
type="button"
- title={`笔记本排序:${activeNotebookSortLabel}`}
- aria-label={`笔记本排序:${activeNotebookSortLabel}`}
+ title={t("notebookPane.sortTitle", { label: activeNotebookSortLabel })}
+ aria-label={t("notebookPane.sortTitle", { label: activeNotebookSortLabel })}
>
<ArrowDownWideNarrow className="h-3.5 w-3.5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-36">
- {NOTEBOOK_SORT_OPTIONS.map((option) => (
+ {notebookSortOptions.map((option) => (
<DropdownMenuCheckboxItem
key={option.value}
checked={notebookSortMode === option.value}
@@ -424,7 +432,7 @@ export const NotebookPane = ({
</div>
{isLoading ? (
- <div className="mb-4 px-2 py-3 text-sm text-slate-500">加载中</div>
+ <div className="mb-4 px-2 py-3 text-sm text-slate-500">{t("notebookPane.loading")}</div>
) : (
<div className="mb-4 space-y-1" data-notebook-tree>
{tree.map((node) => (
@@ -447,9 +455,9 @@ export const NotebookPane = ({
</div>
)}
- <nav className="space-y-1 border-t border-slate-100 pt-3" aria-label="辅助入口">
- <SidebarNavButton icon={<Tags className="h-4 w-4" />} label="标签" onClick={onOpenTags} />
- <SidebarNavButton icon={<Archive className="h-4 w-4" />} label="附件" onClick={onOpenAssets} />
+ <nav className="space-y-1 border-t border-slate-100 pt-3" aria-label={t("notebookPane.secondaryEntries")}>
+ <SidebarNavButton icon={<Tags className="h-4 w-4" />} label={t("mobileSheets.tags")} onClick={onOpenTags} />
+ <SidebarNavButton icon={<Archive className="h-4 w-4" />} label={t("mobileSheets.assets")} onClick={onOpenAssets} />
<SidebarTrashNavButton active={view === "trash"} onOpenTrash={onOpenTrash} onEmptyTrash={onEmptyTrash} />
</nav>
</div>
@@ -460,13 +468,13 @@ export const NotebookPane = ({
onClick={onOpenSettings}
className="flex h-8 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium leading-none text-slate-700 transition-colors duration-200 hover:bg-slate-50 hover:text-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400/70"
type="button"
- title="个人中心"
- aria-label="个人中心"
+ title={t("notebookPane.profile")}
+ aria-label={t("notebookPane.profile")}
>
<span className="flex h-4 w-4 shrink-0 items-center justify-center">
<CircleUserRound className="h-4 w-4" />
</span>
- <span className="min-w-0 flex-1 truncate">个人中心</span>
+ <span className="min-w-0 flex-1 truncate">{t("notebookPane.profile")}</span>
</button>
</div>
</footer>
diff --git a/apps/web/src/components/NotebookTreeItem.tsx b/apps/web/src/components/NotebookTreeItem.tsx
index 5ad71c58..142bc0a2 100644
--- a/apps/web/src/components/NotebookTreeItem.tsx
+++ b/apps/web/src/components/NotebookTreeItem.tsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useRef, type DragEvent } from "react";
+import { useTranslation } from "react-i18next";
import { ChevronDown, ChevronRight, Notebook as NotebookIcon, Plus, Pencil, Trash2 } from "lucide-react";
import type { NotebookNode, NotebookDropPosition } from "@/lib/app-helpers";
import {
@@ -50,6 +51,7 @@ export const NotebookTreeItem = ({
expandSiblingsRequest: { parentId: string | null; token: number } | null;
onExpandSiblings: (parentId: string | null) => void;
}) => {
+ const { t } = useTranslation();
const [open, setOpen] = useState(true);
const hasChildren = node.children.length > 0;
const selected = node.id === selectedNotebookId;
@@ -167,7 +169,7 @@ export const NotebookTreeItem = ({
event.dataTransfer.effectAllowed = "move";
event.dataTransfer.setData(NOTEBOOK_DRAG_MIME, node.id);
event.dataTransfer.setData("text/plain", node.id);
- setMemoDragPreview(event.dataTransfer, `移动笔记本「${node.name}」`);
+ setMemoDragPreview(event.dataTransfer, t("notebookTree.dragNotebook", { name: node.name }));
}}
onDragOver={handleDragOver}
onDragLeave={() => {
@@ -183,8 +185,8 @@ export const NotebookTreeItem = ({
className="flex h-6 w-5 items-center justify-center rounded hover:bg-slate-100/50 transition-colors"
type="button"
onClick={() => setOpen((value) => !value)}
- title="展开/折叠"
- aria-label={open ? `收起 ${node.name}` : `展开 ${node.name}`}
+ title={t("notebookTree.expandCollapse")}
+ aria-label={open ? t("notebookTree.collapse", { name: node.name }) : t("notebookTree.expand", { name: node.name })}
aria-expanded={open}
>
{open ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
@@ -196,7 +198,7 @@ export const NotebookTreeItem = ({
data-notebook-tree-button
className="flex min-w-0 flex-1 items-center gap-2 text-left"
type="button"
- aria-label={selected ? `当前:${node.name}` : `切换到 ${node.name}`}
+ aria-label={selected ? t("notebookTree.current", { name: node.name }) : t("notebookTree.switchTo", { name: node.name })}
aria-current={selected ? "page" : undefined}
aria-expanded={hasChildren ? open : undefined}
onClick={() => onSelect(node.id)}
@@ -242,8 +244,8 @@ export const NotebookTreeItem = ({
selected ? "hover:bg-slate-200" : "hover:bg-slate-100"
)}
type="button"
- title="新建子笔记本"
- aria-label={`在 ${node.name} 下新建子笔记本`}
+ title={t("notebookTree.newChild")}
+ aria-label={t("notebookTree.newChildAria", { name: node.name })}
onClick={(event) => {
event.stopPropagation();
onCreateNotebook(node.id);
@@ -257,8 +259,8 @@ export const NotebookTreeItem = ({
selected ? "hover:bg-slate-200" : "hover:bg-slate-100"
)}
type="button"
- title="重命名笔记本"
- aria-label={`重命名 ${node.name}`}
+ title={t("notebookTree.renameNotebook")}
+ aria-label={t("notebookTree.renameAria", { name: node.name })}
onClick={(event) => {
event.stopPropagation();
onRenameNotebook(node);
@@ -270,8 +272,8 @@ export const NotebookTreeItem = ({
<button
className="hidden h-6 w-6 items-center justify-center rounded-md text-rose-600 hover:bg-rose-50 group-focus-within:flex group-hover:flex transition-colors duration-150"
type="button"
- title="删除笔记本"
- aria-label={`删除 ${node.name}`}
+ title={t("notebookTree.deleteNotebook")}
+ aria-label={t("notebookTree.deleteAria", { name: node.name })}
onClick={(event) => {
event.stopPropagation();
onDeleteNotebook(node);
@@ -294,14 +296,14 @@ export const NotebookTreeItem = ({
onClick={() => onCreateNotebook(node.id)}
>
<Plus className="h-4 w-4" />
- 新建子笔记本
+ {t("notebookTree.newChild")}
</ContextMenuItem>
<ContextMenuItem
className="flex h-9 items-center gap-2 px-3 text-sm text-slate-700 hover:bg-slate-50 cursor-pointer outline-none"
onClick={() => onRenameNotebook(node)}
>
<Pencil className="h-4 w-4" />
- 重命名
+ {t("notebookTree.rename")}
</ContextMenuItem>
{!isInbox && (
<>
@@ -311,7 +313,7 @@ export const NotebookTreeItem = ({
onClick={() => onDeleteNotebook(node)}
>
<Trash2 className="h-4 w-4" />
- 删除笔记本
+ {t("notebookTree.deleteNotebook")}
</ContextMenuItem>
</>
)}
diff --git a/apps/web/src/components/PwaUpdateNotice.tsx b/apps/web/src/components/PwaUpdateNotice.tsx
index 4f88e6ba..2f9b516c 100644
--- a/apps/web/src/components/PwaUpdateNotice.tsx
+++ b/apps/web/src/components/PwaUpdateNotice.tsx
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useState } from "react";
import { CheckCircle2, RefreshCw, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import {
@@ -50,30 +51,16 @@ const watchDisplayMode = (onChange: () => void) => {
};
};
-const noticeCopy: Record<PwaUpdateNoticeKind, { title: string; description: string }> = {
- checking: {
- title: "发现新版本",
- description: "正在应用更新,稍后会自动刷新。",
- },
- updated: {
- title: "EdgeEver 已更新",
- description: "当前应用已是最新版本。",
- },
- "reload-required": {
- title: "新版本已就绪",
- description: "刷新后即可使用最新功能。",
- },
-};
-
-const getNoticeDescription = (notice: Notice, fallbackDescription: string) => {
+const getNoticeDescription = (notice: Notice, fallbackDescription: string, t: ReturnType<typeof useTranslation>["t"]) => {
if (notice.kind === "updated" && notice.buildLabel) {
- return `当前应用已是最新版本(${notice.buildLabel})。`;
+ return t("pwa.latestWithBuild", { buildLabel: notice.buildLabel });
}
return fallbackDescription;
};
export const PwaUpdateNotice = () => {
+ const { t } = useTranslation();
const [displayMode, setDisplayMode] = useState(() => getDisplayMode());
const [notice, setNotice] = useState<Notice | null>(null);
@@ -114,7 +101,25 @@ export const PwaUpdateNotice = () => {
return () => window.clearTimeout(timeout);
}, [notice]);
- const copy = useMemo(() => (notice ? noticeCopy[notice.kind] : null), [notice]);
+ const noticeCopy = useMemo<Record<PwaUpdateNoticeKind, { title: string; description: string }>>(
+ () => ({
+ checking: {
+ title: t("pwa.checkingTitle"),
+ description: t("pwa.checkingDescription"),
+ },
+ updated: {
+ title: t("pwa.appliedTitle"),
+ description: t("pwa.appliedDescription"),
+ },
+ "reload-required": {
+ title: t("pwa.readyTitle"),
+ description: t("pwa.readyDescription"),
+ },
+ }),
+ [t]
+ );
+
+ const copy = useMemo(() => (notice ? noticeCopy[notice.kind] : null), [notice, noticeCopy]);
if (!displayMode.visible || !notice || !copy) {
return null;
@@ -145,17 +150,17 @@ export const PwaUpdateNotice = () => {
</div>
<div className="min-w-0 flex-1">
<div className="text-sm font-semibold leading-5">{copy.title}</div>
- <div className="mt-0.5 text-xs leading-5 text-slate-500">{getNoticeDescription(notice, copy.description)}</div>
+ <div className="mt-0.5 text-xs leading-5 text-slate-500">{getNoticeDescription(notice, copy.description, t)}</div>
{isReloadRequired ? (
<Button className="mt-2" size="sm" variant="solid" onClick={() => window.location.reload()}>
- 立即刷新
+ {t("pwa.refreshNow")}
</Button>
) : null}
</div>
<button
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
type="button"
- aria-label="关闭更新通知"
+ aria-label={t("pwa.closeNotice")}
onClick={() => setNotice(null)}
>
<X className="h-4 w-4" />
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsx
index 3ceff01d..67d921e1 100644
--- a/apps/web/src/components/SettingsPane.tsx
+++ b/apps/web/src/components/SettingsPane.tsx
@@ -1,4 +1,5 @@
import { ChevronLeft, User } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import type { ShortcutSettings } from "@/lib/app-helpers";
import { AdvancedPlayCard } from "./settings/AdvancedPlayCard";
@@ -29,43 +30,47 @@ export const SettingsPane = ({
isLoggingOut,
authRequired,
onShowGuide,
-}: SettingsPaneProps) => (
- <div className="flex h-full min-h-0 min-w-0 flex-col overflow-x-hidden bg-slate-50">
- <header className="flex h-[calc(3.5rem+env(safe-area-inset-top))] shrink-0 items-end justify-between border-b border-slate-200 bg-white px-4 pb-3 pt-[env(safe-area-inset-top)] lg:h-16 lg:items-center lg:px-6 lg:pb-0 lg:pt-0">
- <div className="flex min-w-0 items-center gap-3">
- <Button
- size="icon"
- variant="ghost"
- title="返回上一页"
- aria-label="返回上一页"
- onClick={onClose}
- className="h-9 w-9 rounded-lg hover:bg-slate-100"
- >
- <ChevronLeft className="h-5 w-5 text-slate-500" />
- </Button>
- <div className="min-w-0">
- <h1 className="flex items-center gap-2 text-base font-bold leading-tight text-slate-900">
- <User className="h-4 w-4 text-emerald-700" />
- 我的
- </h1>
- <p className="mt-0.5 truncate text-xs font-medium text-slate-400">个人偏好、MCP Token 与登录会话</p>
+}: SettingsPaneProps) => {
+ const { t } = useTranslation();
+
+ return (
+ <div className="flex h-full min-h-0 min-w-0 flex-col overflow-x-hidden bg-slate-50">
+ <header className="flex h-[calc(3.5rem+env(safe-area-inset-top))] shrink-0 items-end justify-between border-b border-slate-200 bg-white px-4 pb-3 pt-[env(safe-area-inset-top)] lg:h-16 lg:items-center lg:px-6 lg:pb-0 lg:pt-0">
+ <div className="flex min-w-0 items-center gap-3">
+ <Button
+ size="icon"
+ variant="ghost"
+ title={t("common.back")}
+ aria-label={t("common.back")}
+ onClick={onClose}
+ className="h-9 w-9 rounded-lg hover:bg-slate-100"
+ >
+ <ChevronLeft className="h-5 w-5 text-slate-500" />
+ </Button>
+ <div className="min-w-0">
+ <h1 className="flex items-center gap-2 text-base font-bold leading-tight text-slate-900">
+ <User className="h-4 w-4 text-emerald-700" />
+ {t("settings.title")}
+ </h1>
+ <p className="mt-0.5 truncate text-xs font-medium text-slate-400">{t("settings.subtitle")}</p>
+ </div>
</div>
- </div>
- </header>
+ </header>
- <div className="min-w-0 flex-1 overflow-x-hidden overflow-y-auto px-4 py-4 lg:px-6 lg:py-6">
- <div className="mx-auto grid w-full min-w-0 max-w-4xl gap-4">
- <PreferenceCard
- imageCompressionEnabled={imageCompressionEnabled}
- onImageCompressionChange={onImageCompressionChange}
- shortcutSettings={shortcutSettings}
- onShortcutSettingsChange={onShortcutSettingsChange}
- />
- <AdvancedPlayCard />
- <EvernoteImportGuideCard onShowGuide={onShowGuide} />
- <McpConfigCard />
- <SessionCard authRequired={authRequired} isLoggingOut={isLoggingOut} onLogout={onLogout} />
+ <div className="min-w-0 flex-1 overflow-x-hidden overflow-y-auto px-4 py-4 lg:px-6 lg:py-6">
+ <div className="mx-auto grid w-full min-w-0 max-w-4xl gap-4">
+ <PreferenceCard
+ imageCompressionEnabled={imageCompressionEnabled}
+ onImageCompressionChange={onImageCompressionChange}
+ shortcutSettings={shortcutSettings}
+ onShortcutSettingsChange={onShortcutSettingsChange}
+ />
+ <AdvancedPlayCard />
+ <EvernoteImportGuideCard onShowGuide={onShowGuide} />
+ <McpConfigCard />
+ <SessionCard authRequired={authRequired} isLoggingOut={isLoggingOut} onLogout={onLogout} />
+ </div>
</div>
</div>
- </div>
-);
+ );
+};
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index f5ce282e..5e57e3aa 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -14,6 +14,7 @@ import {
} from "react";
import { useInfiniteQuery, useQuery, useMutation, useQueryClient, type QueryClient } from "@tanstack/react-query";
import { Home, Search, UserRound, Plus, ChevronDown, ChevronRight, RefreshCw, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { useLocation, useNavigate } from "react-router";
import { Button } from "@/components/ui/button";
import {
@@ -115,7 +116,7 @@ const emptySyncQueueSummary = (): SyncQueueSummary => ({
error: 0,
});
-const PaneLoadingFallback = ({ label = "正在加载" }: { label?: string }) => (
+const PaneLoadingFallback = ({ label = "Loading" }: { label?: string }) => (
<div className="flex h-full min-h-0 items-center justify-center bg-white text-sm font-medium text-slate-400" role="status">
{label}
</div>
@@ -206,28 +207,33 @@ const MobileBottomNav = ({
onCreateMemo: () => void;
onHome: () => void;
onOpenSettings: () => void;
-}) => (
- <nav
- className="fixed inset-x-0 bottom-0 z-40 border-t border-slate-200 bg-white/95 px-5 pb-[max(0.125rem,env(safe-area-inset-bottom))] pt-0 shadow-[0_-10px_30px_rgba(15,23,42,0.08)] backdrop-blur lg:hidden"
- aria-label="移动端主导航"
- >
- <div className="relative grid h-12 grid-cols-3 items-center">
- <MobileBottomNavButton active={activeItem === "home"} icon={<Home className="h-5 w-5" />} label="首页" onClick={onHome} />
- <div aria-hidden="true" />
- <MobileBottomNavButton active={activeItem === "settings"} icon={<UserRound className="h-5 w-5" />} label="我的" onClick={onOpenSettings} />
- <button
- className="absolute left-1/2 top-[-0.8rem] flex h-[3.25rem] w-[3.25rem] -translate-x-1/2 items-center justify-center rounded-full border-[5px] border-white bg-emerald-500 text-white shadow-[0_12px_26px_rgb(var(--brand-green-rgb)/0.32)] transition hover:bg-emerald-600 disabled:cursor-not-allowed disabled:bg-emerald-200 disabled:opacity-70 disabled:hover:bg-emerald-200"
- type="button"
- title={!canCreateMemo ? "当前视图不可新建笔记" : isCreating ? "正在创建" : "新建笔记"}
- aria-label={!canCreateMemo ? "当前视图不可新建笔记" : isCreating ? "正在创建" : "新建笔记"}
- disabled={!canCreateMemo || isCreating}
- onClick={onCreateMemo}
- >
- <Plus className="h-7 w-7" />
- </button>
- </div>
- </nav>
-);
+}) => {
+ const { t } = useTranslation();
+ const createMemoLabel = !canCreateMemo ? t("nav.createDisabled") : isCreating ? t("nav.creating") : t("nav.createMemo");
+
+ return (
+ <nav
+ className="fixed inset-x-0 bottom-0 z-40 border-t border-slate-200 bg-white/95 px-5 pb-[max(0.125rem,env(safe-area-inset-bottom))] pt-0 shadow-[0_-10px_30px_rgba(15,23,42,0.08)] backdrop-blur lg:hidden"
+ aria-label={t("nav.mobileMain")}
+ >
+ <div className="relative grid h-12 grid-cols-3 items-center">
+ <MobileBottomNavButton active={activeItem === "home"} icon={<Home className="h-5 w-5" />} label={t("nav.home")} onClick={onHome} />
+ <div aria-hidden="true" />
+ <MobileBottomNavButton active={activeItem === "settings"} icon={<UserRound className="h-5 w-5" />} label={t("nav.mine")} onClick={onOpenSettings} />
+ <button
+ className="absolute left-1/2 top-[-0.8rem] flex h-[3.25rem] w-[3.25rem] -translate-x-1/2 items-center justify-center rounded-full border-[5px] border-white bg-emerald-500 text-white shadow-[0_12px_26px_rgb(var(--brand-green-rgb)/0.32)] transition hover:bg-emerald-600 disabled:cursor-not-allowed disabled:bg-emerald-200 disabled:opacity-70 disabled:hover:bg-emerald-200"
+ type="button"
+ title={createMemoLabel}
+ aria-label={createMemoLabel}
+ disabled={!canCreateMemo || isCreating}
+ onClick={onCreateMemo}
+ >
+ <Plus className="h-7 w-7" />
+ </button>
+ </div>
+ </nav>
+ );
+};
const MobileNotebookPicker = ({
currentLabel,
@@ -244,6 +250,7 @@ const MobileNotebookPicker = ({
onSelectAll: () => void;
onSelect: (notebookId: string) => void;
}) => {
+ const { t } = useTranslation();
const listRef = useRef<HTMLDivElement | null>(null);
const [notebookSearch, setNotebookSearch] = useState("");
const tree = useMemo(() => buildNotebookTree(notebooks), [notebooks]);
@@ -256,7 +263,7 @@ const MobileNotebookPicker = ({
const [expandedNotebookIds, setExpandedNotebookIds] = useState<Set<string>>(() => new Set(selectedAncestorIds));
const allSelected = !currentLabel && selectedNotebookId === null;
const selectedNotebookName =
- currentLabel ?? (allSelected ? "全部笔记" : notebooks.find((item) => item.id === selectedNotebookId)?.name ?? "笔记本");
+ currentLabel ?? (allSelected ? t("mobileNotebookPicker.allMemos") : notebooks.find((item) => item.id === selectedNotebookId)?.name ?? t("mobileNotebookPicker.notebookFallback"));
const searchQuery = notebookSearch.trim();
const searchActive = Boolean(searchQuery);
const allNotebookBranchesExpanded =
@@ -308,10 +315,10 @@ const MobileNotebookPicker = ({
<DrawerContent className="inset-x-0 max-h-[82dvh] overflow-hidden border-x-0 border-b-0 pb-[env(safe-area-inset-bottom)] lg:hidden">
<header className="flex h-14 items-center justify-between border-b border-slate-200 px-4">
<DrawerHeader className="min-w-0 p-0">
- <DrawerTitle className="text-base">切换笔记本</DrawerTitle>
- <DrawerDescription className="truncate">当前:{selectedNotebookName}</DrawerDescription>
+ <DrawerTitle className="text-base">{t("mobileNotebookPicker.title")}</DrawerTitle>
+ <DrawerDescription className="truncate">{t("mobileNotebookPicker.current", { name: selectedNotebookName })}</DrawerDescription>
</DrawerHeader>
- <Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
+ <Button size="icon" variant="ghost" title={t("common.close")} aria-label={t("common.close")} onClick={onClose}>
<X className="h-4 w-4" />
</Button>
</header>
@@ -321,8 +328,8 @@ const MobileNotebookPicker = ({
<input
className="min-w-0 flex-1 bg-transparent text-slate-900 outline-none placeholder:text-slate-400"
value={notebookSearch}
- placeholder="搜索笔记本"
- aria-label="搜索笔记本"
+ placeholder={t("mobileNotebookPicker.searchPlaceholder")}
+ aria-label={t("mobileNotebookPicker.searchPlaceholder")}
onChange={(event) => setNotebookSearch(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Escape" && notebookSearch) {
@@ -335,8 +342,8 @@ const MobileNotebookPicker = ({
<button
className="flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-white hover:text-slate-700"
type="button"
- title="清空搜索"
- aria-label="清空搜索"
+ title={t("mobileNotebookPicker.clearSearch")}
+ aria-label={t("mobileNotebookPicker.clearSearch")}
onMouseDown={(event) => event.preventDefault()}
onClick={() => setNotebookSearch("")}
>
@@ -353,25 +360,25 @@ const MobileNotebookPicker = ({
)}
type="button"
data-mobile-notebook-id="__all__"
- aria-label={allSelected ? "当前:全部笔记" : "切换到全部笔记"}
+ aria-label={allSelected ? t("mobileNotebookPicker.currentAll") : t("mobileNotebookPicker.switchAll")}
aria-current={allSelected ? "page" : undefined}
onClick={onSelectAll}
>
- <span className="min-w-0 flex-1 truncate text-base">全部笔记</span>
+ <span className="min-w-0 flex-1 truncate text-base">{t("mobileNotebookPicker.allMemos")}</span>
</button>
{filteredTree.length > 0 ? (
<>
<div className="mb-1 flex h-8 items-center justify-between px-3 text-xs font-semibold text-slate-400">
- <span>{searchActive ? "匹配的笔记本" : "笔记本"}</span>
+ <span>{searchActive ? t("mobileNotebookPicker.matchedNotebooks") : t("mobileNotebookPicker.notebooks")}</span>
{!searchActive && expandableNotebookIds.length > 0 && (
<button
className="rounded-md px-2 py-1 text-slate-500 transition hover:bg-slate-100 hover:text-slate-900"
type="button"
- aria-label={allNotebookBranchesExpanded ? "收起全部笔记本" : "展开全部笔记本"}
+ aria-label={allNotebookBranchesExpanded ? t("mobileNotebookPicker.collapseAllAria") : t("mobileNotebookPicker.expandAllAria")}
aria-pressed={allNotebookBranchesExpanded}
onClick={handleToggleAllNotebookBranches}
>
- {allNotebookBranchesExpanded ? "收起全部" : "展开全部"}
+ {allNotebookBranchesExpanded ? t("mobileNotebookPicker.collapseAll") : t("mobileNotebookPicker.expandAll")}
</button>
)}
</div>
@@ -391,7 +398,7 @@ const MobileNotebookPicker = ({
) : (
<div className="px-3 py-8 text-center">
<div className="text-sm font-medium text-slate-700">
- {searchQuery ? `没有找到「${searchQuery}」` : "没有找到笔记本"}
+ {searchQuery ? t("mobileNotebookPicker.noSearchResult", { query: searchQuery }) : t("mobileNotebookPicker.noNotebook")}
</div>
{searchQuery && (
<button
@@ -399,7 +406,7 @@ const MobileNotebookPicker = ({
type="button"
onClick={() => setNotebookSearch("")}
>
- 显示全部笔记本
+ {t("mobileNotebookPicker.showAll")}
</button>
)}
</div>
@@ -427,6 +434,7 @@ const MobileNotebookPickerItem = ({
onSelect: (notebookId: string) => void;
onToggleExpanded: (notebookId: string) => void;
}) => {
+ const { t } = useTranslation();
const selected = node.id === selectedNotebookId;
const hasChildren = node.children.length > 0;
const hasSelectedDescendant = selectedNotebookId ? notebookTreeContainsId(node.children, selectedNotebookId) : false;
@@ -454,7 +462,7 @@ const MobileNotebookPickerItem = ({
)}
type="button"
disabled={searchActive}
- aria-label={expanded ? `收起 ${node.name}` : `展开 ${node.name}`}
+ aria-label={expanded ? t("mobileNotebookPicker.collapse", { name: node.name }) : t("mobileNotebookPicker.expand", { name: node.name })}
aria-expanded={expanded}
onClick={(event) => {
event.stopPropagation();
@@ -469,7 +477,7 @@ const MobileNotebookPickerItem = ({
<button
className="flex min-w-0 flex-1 items-center gap-3 text-left"
type="button"
- aria-label={selected ? `当前:${node.name}` : `切换到 ${node.name}`}
+ aria-label={selected ? t("mobileNotebookPicker.currentNotebook", { name: node.name }) : t("mobileNotebookPicker.switchToNotebook", { name: node.name })}
aria-current={selected ? "page" : undefined}
onClick={() => onSelect(node.id)}
>
@@ -507,6 +515,7 @@ export const WorkspaceApp = ({
isLoggingOut: boolean;
onLogout: () => void;
}) => {
+ const { t } = useTranslation();
const queryClient = useQueryClient();
const location = useLocation();
const navigate = useNavigate();
@@ -1236,8 +1245,8 @@ export const WorkspaceApp = ({
const handleDeleteNotebook = (notebook: Notebook) => {
if (notebook.slug === "inbox") {
setAppNoticeDialog({
- title: "等待分类不能删除",
- description: "等待分类是默认笔记本,用来保证新笔记始终有归属。",
+ title: t("workspace.inboxDeleteTitle"),
+ description: t("workspace.inboxDeleteDescription"),
});
return;
}
@@ -1400,41 +1409,41 @@ export const WorkspaceApp = ({
const allSelectedMemosPinned =
selectedMemosInCurrentList.length > 0 && selectedMemosInCurrentList.every((memo) => memo.isPinned);
const selectedPinTarget = !allSelectedMemosPinned;
- const selectionPinLabel = allSelectedMemosPinned ? "取消置顶" : "置顶";
+ const selectionPinLabel = allSelectedMemosPinned ? t("workspace.selection.unpin") : t("workspace.selection.pin");
const selectionPinTitle =
selectedMemoIds.size === 0
- ? "请选择笔记"
+ ? t("workspace.selection.chooseMemo")
: memoView === "trash"
- ? "回收站内不可置顶"
+ ? t("workspace.selection.trashCannotPin")
: pinMemosMutation.isPending
- ? "正在更新置顶"
+ ? t("workspace.selection.updatingPin")
: selectionPinLabel;
const selectionMoveTitle =
selectedMemoIds.size === 0
- ? "请选择笔记"
+ ? t("workspace.selection.chooseMemo")
: memoView === "trash"
- ? "回收站内不可移动"
+ ? t("workspace.selection.trashCannotMove")
: notebooks.length === 0
- ? "没有可移动的笔记本"
+ ? t("workspace.selection.noMovableNotebook")
: moveMemosMutation.isPending
- ? "正在移动"
- : "移动";
+ ? t("workspace.selection.moving")
+ : t("workspace.selection.move");
const selectionMergeTitle =
selectedMemoIds.size < 2
- ? "至少选择 2 条笔记"
+ ? t("workspace.selection.needTwoMemos")
: memoView === "trash"
- ? "回收站内不可合并"
+ ? t("workspace.selection.trashCannotMerge")
: mergeMutation.isPending
- ? "正在合并"
- : "合并笔记";
+ ? t("workspace.selection.merging")
+ : t("workspace.selection.merge");
const selectionDeleteTitle =
selectedMemoIds.size === 0
- ? "请选择笔记"
+ ? t("workspace.selection.chooseMemo")
: deleteMemosMutation.isPending || deleteMemoMutation.isPending
- ? "正在删除"
+ ? t("workspace.selection.deleting")
: memoView === "trash"
- ? "永久删除"
- : "删除";
+ ? t("workspace.selection.permanentDelete")
+ : t("workspace.selection.delete");
const memoSelectionActionBar = memoSelectionModeActive ? (
<MemoSelectionActionBar
deleteTitle={selectionDeleteTitle}
@@ -1909,20 +1918,26 @@ export const WorkspaceApp = ({
const shouldRenderRightPane = isDesktop || activePane === "editor";
const rightPaneLoadingLabel =
- rightView === "settings" ? "正在加载个人中心" : rightView === "assets" ? "正在加载资源库" : rightView === "evernote-migration" ? "正在加载迁移指引" : "正在加载编辑器";
+ rightView === "settings"
+ ? t("workspace.loading.settings")
+ : rightView === "assets"
+ ? t("workspace.loading.assets")
+ : rightView === "evernote-migration"
+ ? t("workspace.loading.migration")
+ : t("workspace.loading.editor");
const pullToRefreshVisible = pullToRefreshDistance > 0 || isPullRefreshing;
const pullToRefreshReady = pullToRefreshDistance >= PULL_TO_REFRESH_TRIGGER_PX;
const pullToRefreshLabel = isPullRefreshing
? isStandaloneRuntime
- ? "正在拉取最新笔记"
- : "正在刷新网页"
+ ? t("workspace.pullToRefresh.refreshingNotes")
+ : t("workspace.pullToRefresh.refreshingPage")
: pullToRefreshReady
? isStandaloneRuntime
- ? "松开刷新"
- : "松开刷新网页"
+ ? t("workspace.pullToRefresh.releaseNotes")
+ : t("workspace.pullToRefresh.releasePage")
: isStandaloneRuntime
- ? "下拉刷新"
- : "下拉刷新网页";
+ ? t("workspace.pullToRefresh.pullNotes")
+ : t("workspace.pullToRefresh.pullPage");
return (
<div className="flex h-[100dvh] overflow-hidden bg-slate-50 text-slate-950">
@@ -1955,7 +1970,7 @@ export const WorkspaceApp = ({
)}
>
{(isDesktop || activePane === "notebooks") && (
- <Suspense fallback={<PaneLoadingFallback label="正在加载笔记本" />}>
+ <Suspense fallback={<PaneLoadingFallback label={t("workspace.loading.notebooks")} />}>
<NotebookPane
authRequired={authRequired}
user={user}
@@ -2120,9 +2135,9 @@ export const WorkspaceApp = ({
aria-valuemin={MIN_MEMO_LIST_WIDTH_PX}
aria-valuemax={MAX_MEMO_LIST_WIDTH_PX}
aria-valuenow={memoListWidth}
- aria-label="调整笔记列表宽度"
+ aria-label={t("workspaceDialogs.resizeMemoList")}
tabIndex={0}
- title="拖拽调整列表栏宽度,双击恢复默认,方向键微调"
+ title={t("workspaceDialogs.resizeMemoListHint")}
onDoubleClick={handleResetMemoListWidth}
onKeyDown={handleMemoListResizeKeyDown}
onPointerDown={handleMemoListResizePointerDown}
@@ -2224,9 +2239,9 @@ export const WorkspaceApp = ({
)}
{emptyTrashConfirmationOpen && (
<AppConfirmDialog
- title="清空回收站"
- description="回收站中的全部笔记和仍关联的附件都会删除,这个操作不可恢复。"
- confirmLabel="清空回收站"
+ title={t("workspaceDialogs.emptyTrashTitle")}
+ description={t("workspaceDialogs.emptyTrashDescription")}
+ confirmLabel={t("workspaceDialogs.emptyTrashConfirm")}
closeOnBrowserBack={false}
isWorking={emptyTrashMutation.isPending}
tone="danger"
@@ -2244,9 +2259,9 @@ export const WorkspaceApp = ({
)}
{notebookDeleteConfirmation && (
<AppConfirmDialog
- title={`删除笔记本「${notebookDeleteConfirmation.name}」`}
- description="请先清空其中的笔记和子笔记本。删除后无法从这里恢复。"
- confirmLabel="删除"
+ title={t("workspaceDialogs.deleteNotebookTitle", { name: notebookDeleteConfirmation.name })}
+ description={t("workspaceDialogs.deleteNotebookDescription")}
+ confirmLabel={t("common.delete")}
closeOnBrowserBack={false}
isWorking={deleteNotebookMutation.isPending}
tone="danger"
@@ -2262,7 +2277,7 @@ export const WorkspaceApp = ({
<AppConfirmDialog
title={appNoticeDialog.title}
description={appNoticeDialog.description}
- confirmLabel="知道了"
+ confirmLabel={t("workspaceDialogs.ok")}
closeOnBrowserBack={false}
hideCancel
tone="neutral"
@@ -2282,7 +2297,7 @@ export const WorkspaceApp = ({
)}
{mobileNotebookPickerOpen && (
<MobileNotebookPicker
- currentLabel={memoView === "trash" ? "回收站" : undefined}
+ currentLabel={memoView === "trash" ? t("notebookPane.trash") : undefined}
notebooks={notebooks}
selectedNotebookId={selectedNotebookId}
onClose={() => setMobileNotebookPickerOpen(false)}
diff --git a/apps/web/src/components/dialogs/ConfirmDialogs.tsx b/apps/web/src/components/dialogs/ConfirmDialogs.tsx
index 7a7c14a6..6827c246 100644
--- a/apps/web/src/components/dialogs/ConfirmDialogs.tsx
+++ b/apps/web/src/components/dialogs/ConfirmDialogs.tsx
@@ -1,5 +1,6 @@
import { useState, useEffect, useRef } from "react";
import { AlertTriangle, ShieldCheck, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
@@ -13,7 +14,7 @@ export type NotebookNameDialogState =
| { mode: "rename"; notebook: Notebook };
export const AppConfirmDialog = ({
- cancelLabel = "取消",
+ cancelLabel,
confirmLabel,
description,
hideCancel = false,
@@ -35,6 +36,7 @@ export const AppConfirmDialog = ({
onCancel: () => void;
onConfirm: () => void;
}) => {
+ const { t } = useTranslation();
const toneClassName =
tone === "danger"
? "bg-rose-50 text-rose-700"
@@ -63,11 +65,11 @@ export const AppConfirmDialog = ({
<DialogFooter className="flex flex-col-reverse gap-2 px-5 py-4 sm:flex-row sm:justify-end border-t border-slate-50 bg-slate-50/50">
{!hideCancel && (
<Button className="justify-center" variant="outline" onClick={onCancel} disabled={isWorking}>
- {cancelLabel}
+ {cancelLabel ?? t("common.cancel")}
</Button>
)}
<Button className="justify-center" variant={confirmVariant} onClick={onConfirm} disabled={isWorking}>
- {isWorking ? "处理中" : confirmLabel}
+ {isWorking ? t("common.processing") : confirmLabel}
</Button>
</DialogFooter>
</DialogContent>
@@ -86,11 +88,18 @@ export const MemoDeleteConfirmDialog = ({
onCancel: () => void;
onConfirm: () => void;
}) => {
+ const { t } = useTranslation();
const count = confirmation.memoIds.length;
const isBulk = confirmation.kind === "bulk" || count > 1;
- const title = confirmation.permanent ? (isBulk ? `永久删除 ${count} 条笔记` : "永久删除笔记") : isBulk ? `删除 ${count} 条笔记` : "删除笔记";
- const description = confirmation.permanent ? "这个操作不可恢复。" : "删除后可以在回收站恢复。";
- const confirmLabel = confirmation.permanent ? "永久删除" : "删除";
+ const title = confirmation.permanent
+ ? isBulk
+ ? t("dialogs.memoDelete.permanentBulkTitle", { count })
+ : t("dialogs.memoDelete.permanentSingleTitle")
+ : isBulk
+ ? t("dialogs.memoDelete.softBulkTitle", { count })
+ : t("dialogs.memoDelete.softSingleTitle");
+ const description = confirmation.permanent ? t("dialogs.memoDelete.permanentDescription") : t("dialogs.memoDelete.softDescription");
+ const confirmLabel = confirmation.permanent ? t("dialogs.memoDelete.permanentConfirm") : t("dialogs.memoDelete.softConfirm");
return (
<AppConfirmDialog
@@ -116,13 +125,14 @@ export const NotebookNameDialog = ({
onCancel: () => void;
onSubmit: (name: string) => void;
}) => {
+ const { t } = useTranslation();
const initialName = dialog.mode === "rename" ? dialog.notebook.name : "";
const [name, setName] = useState(initialName);
const inputRef = useRef<HTMLInputElement | null>(null);
const trimmedName = name.trim();
const unchanged = dialog.mode === "rename" && trimmedName === dialog.notebook.name;
- const title = dialog.mode === "create" ? "新建笔记本" : "重命名笔记本";
- const submitLabel = dialog.mode === "create" ? "创建" : "保存";
+ const title = dialog.mode === "create" ? t("dialogs.notebookName.createTitle") : t("dialogs.notebookName.renameTitle");
+ const submitLabel = dialog.mode === "create" ? t("dialogs.notebookName.createSubmit") : t("common.save");
useEffect(() => {
setName(initialName);
@@ -153,13 +163,13 @@ export const NotebookNameDialog = ({
{title}
</DialogTitle>
<DialogDescription className="mt-1 text-sm leading-5 text-slate-500">
- {dialog.mode === "create" ? "创建一个新的笔记本,用来整理相关笔记。" : "更新后会立即同步到笔记本树。"}
+ {dialog.mode === "create" ? t("dialogs.notebookName.createDescription") : t("dialogs.notebookName.renameDescription")}
</DialogDescription>
</div>
</DialogHeader>
<div className="px-5 py-5">
<label className="block text-xs font-semibold uppercase text-slate-500" htmlFor="notebook-name-input">
- 名称
+ {t("dialogs.notebookName.nameLabel")}
</label>
<Input
id="notebook-name-input"
@@ -168,16 +178,16 @@ export const NotebookNameDialog = ({
value={name}
disabled={isSaving}
maxLength={80}
- placeholder="笔记本名称"
+ placeholder={t("dialogs.notebookName.namePlaceholder")}
onChange={(event) => setName(event.target.value)}
/>
</div>
<DialogFooter className="flex flex-col-reverse gap-2 px-5 py-4 sm:flex-row sm:justify-end border-t border-slate-50 bg-slate-50/50">
<Button className="justify-center" type="button" variant="outline" onClick={onCancel} disabled={isSaving}>
- 取消
+ {t("common.cancel")}
</Button>
<Button className="justify-center" type="submit" variant="solid" disabled={!trimmedName || unchanged || isSaving}>
- {isSaving ? "保存中" : submitLabel}
+ {isSaving ? t("common.saving") : submitLabel}
</Button>
</DialogFooter>
</form>
diff --git a/apps/web/src/components/dialogs/RevisionHistoryDialog.tsx b/apps/web/src/components/dialogs/RevisionHistoryDialog.tsx
index c8086bec..cf3c8aef 100644
--- a/apps/web/src/components/dialogs/RevisionHistoryDialog.tsx
+++ b/apps/web/src/components/dialogs/RevisionHistoryDialog.tsx
@@ -1,6 +1,7 @@
import { useState, useMemo, useEffect } from "react";
import { useQuery, useMutation } from "@tanstack/react-query";
import { History, RotateCcw, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog";
import { api } from "@/lib/api";
@@ -36,14 +37,18 @@ const formatRevisionActor = (actor: string) => {
return actor || "system";
};
-export const RevisionPreview = ({ title, markdown }: { title: string; markdown: string }) => (
- <div className="min-h-[260px] border-b border-slate-200 p-4 sm:border-b-0 sm:border-r">
- <div className="mb-3 text-xs font-semibold uppercase text-slate-500">{title}</div>
- <pre className="max-h-[54dvh] overflow-auto whitespace-pre-wrap break-words rounded-md border border-slate-200 bg-slate-50 p-3 text-sm leading-6 text-slate-700">
- {markdown || "空笔记"}
- </pre>
- </div>
-);
+export const RevisionPreview = ({ title, markdown }: { title: string; markdown: string }) => {
+ const { t } = useTranslation();
+
+ return (
+ <div className="min-h-[260px] border-b border-slate-200 p-4 sm:border-b-0 sm:border-r">
+ <div className="mb-3 text-xs font-semibold uppercase text-slate-500">{title}</div>
+ <pre className="max-h-[54dvh] overflow-auto whitespace-pre-wrap break-words rounded-md border border-slate-200 bg-slate-50 p-3 text-sm leading-6 text-slate-700">
+ {markdown || t("revisions.emptyMemo")}
+ </pre>
+ </div>
+ );
+};
export const RevisionHistoryDialog = ({
memo,
@@ -56,6 +61,7 @@ export const RevisionHistoryDialog = ({
onClose: () => void;
onRestored: (memo: MemoDetail) => Promise<void>;
}) => {
+ const { t } = useTranslation();
const [selectedRevisionId, setSelectedRevisionId] = useState<string | null>(null);
const [restoreRevisionConfirmationId, setRestoreRevisionConfirmationId] = useState<string | null>(null);
@@ -94,7 +100,7 @@ export const RevisionHistoryDialog = ({
<div className="min-w-0">
<DialogTitle className="flex items-center gap-2 text-base font-semibold text-slate-950">
<History className="h-4 w-4 text-emerald-700" />
- 版本历史
+ {t("revisions.title")}
</DialogTitle>
<DialogDescription className="mt-1 truncate text-xs text-slate-500">
{getMemoTitle(memo.title)}
@@ -105,10 +111,10 @@ export const RevisionHistoryDialog = ({
<div className="grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] sm:grid-cols-[280px_minmax(0,1fr)] sm:grid-rows-1">
<aside className="min-h-0 border-b border-slate-200 p-3 sm:border-b-0 sm:border-r max-h-[220px] sm:max-h-[60vh] overflow-y-auto">
{revisionsQuery.isLoading ? (
- <div className="px-2 py-8 text-center text-sm text-slate-500">加载中</div>
+ <div className="px-2 py-8 text-center text-sm text-slate-500">{t("revisions.loading")}</div>
) : revisions.length === 0 ? (
<div className="rounded-md border border-dashed border-slate-300 px-4 py-8 text-center text-sm text-slate-500">
- 暂无历史版本
+ {t("revisions.empty")}
</div>
) : (
<div className="space-y-2">
@@ -141,7 +147,7 @@ export const RevisionHistoryDialog = ({
<div className="flex min-h-0 flex-col">
<div className="flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-slate-200 px-4 py-3 bg-slate-50/50">
<div className="text-xs font-medium text-slate-500">
- {selectedRevision ? `${diffSummary.changed} changed lines` : "No revision selected"}
+ {selectedRevision ? t("revisions.changedLines", { count: diffSummary.changed }) : t("revisions.noRevisionSelected")}
</div>
<Button
size="sm"
@@ -154,13 +160,13 @@ export const RevisionHistoryDialog = ({
}}
>
<RotateCcw className="h-4 w-4" />
- 恢复该版本
+ {t("revisions.restoreVersion")}
</Button>
</div>
<div className="grid min-h-0 flex-1 gap-0 overflow-y-auto sm:grid-cols-2 max-h-[50vh]">
- <RevisionPreview title="历史版本" markdown={selectedRevision?.contentMarkdown ?? ""} />
- <RevisionPreview title="当前内容" markdown={currentMarkdown} />
+ <RevisionPreview title={t("revisions.historyVersion")} markdown={selectedRevision?.contentMarkdown ?? ""} />
+ <RevisionPreview title={t("revisions.currentContent")} markdown={currentMarkdown} />
</div>
</div>
</div>
@@ -168,9 +174,9 @@ export const RevisionHistoryDialog = ({
{restoreRevisionConfirmationId && (
<AppConfirmDialog
- title="恢复到这个历史版本"
- description="当前内容会被这个历史版本替换,恢复后仍会产生新的历史记录。"
- confirmLabel="恢复"
+ title={t("revisions.restoreConfirmTitle")}
+ description={t("revisions.restoreConfirmDescription")}
+ confirmLabel={t("revisions.restoreConfirmLabel")}
isWorking={restoreMutation.isPending}
tone="primary"
onCancel={() => setRestoreRevisionConfirmationId(null)}
diff --git a/apps/web/src/components/dialogs/TagsDialog.tsx b/apps/web/src/components/dialogs/TagsDialog.tsx
index 0c14fc20..53f924a8 100644
--- a/apps/web/src/components/dialogs/TagsDialog.tsx
+++ b/apps/web/src/components/dialogs/TagsDialog.tsx
@@ -1,6 +1,7 @@
import { useState } from "react";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { Tags, X, Pencil, Trash2 } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
@@ -10,6 +11,7 @@ import { AppConfirmDialog } from "./ConfirmDialogs";
import type { TagSummary } from "@edgeever/shared";
export const TagsDialog = ({ onClose }: { onClose: () => void }) => {
+ const { t } = useTranslation();
const queryClient = useQueryClient();
const [editingTagName, setEditingTagName] = useState<string | null>(null);
const [editingTagValue, setEditingTagValue] = useState("");
@@ -77,20 +79,20 @@ export const TagsDialog = ({ onClose }: { onClose: () => void }) => {
<div className="min-w-0">
<DialogTitle className="flex items-center gap-2 text-base font-semibold text-slate-950">
<Tags className="h-4 w-4 text-emerald-700" />
- 标签
+ {t("tagsDialog.title")}
</DialogTitle>
<DialogDescription className="mt-1 text-xs text-slate-500">
- {tags.length} tags
+ {t("tagsDialog.count", { count: tags.length })}
</DialogDescription>
</div>
</DialogHeader>
<div className="max-h-[60vh] overflow-y-auto p-5">
{tagsQuery.isLoading ? (
- <div className="px-2 py-8 text-center text-sm text-slate-500">加载中</div>
+ <div className="px-2 py-8 text-center text-sm text-slate-500">{t("tagsDialog.loading")}</div>
) : tags.length === 0 ? (
<div className="rounded-md border border-dashed border-slate-300 px-4 py-8 text-center text-sm text-slate-500">
- 暂无标签
+ {t("tagsDialog.empty")}
</div>
) : (
<div className="space-y-2">
@@ -116,7 +118,7 @@ export const TagsDialog = ({ onClose }: { onClose: () => void }) => {
}}
>
<label className="sr-only" htmlFor={`tag-rename-${tag.name}`}>
- 标签名称
+ {t("tagsDialog.nameLabel")}
</label>
<Input
id={`tag-rename-${tag.name}`}
@@ -141,10 +143,10 @@ export const TagsDialog = ({ onClose }: { onClose: () => void }) => {
variant="solid"
disabled={!nextName || nextName === tag.name || renameMutation.isPending}
>
- 保存
+ {t("common.save")}
</Button>
<Button size="sm" type="button" variant="outline" onClick={handleCancelRename} disabled={renameMutation.isPending}>
- 取消
+ {t("common.cancel")}
</Button>
</div>
</form>
@@ -152,17 +154,17 @@ export const TagsDialog = ({ onClose }: { onClose: () => void }) => {
<>
<span className="block truncate text-sm font-semibold text-slate-950">#{tag.name}</span>
<span className="mt-1 block text-xs text-slate-500">
- {tag.memoCount} 条笔记{tag.updatedAt ? ` · ${formatDateTime(tag.updatedAt)}` : ""}
+ {t("tagsDialog.memoCount", { count: tag.memoCount })}{tag.updatedAt ? ` · ${formatDateTime(tag.updatedAt)}` : ""}
</span>
</>
)}
</span>
{!isEditing && (
<>
- <Button size="icon" variant="ghost" title="重命名标签" aria-label={`重命名标签 ${tag.name}`} onClick={() => handleRename(tag)}>
+ <Button size="icon" variant="ghost" title={t("tagsDialog.renameTitle")} aria-label={t("tagsDialog.renameAria", { name: tag.name })} onClick={() => handleRename(tag)}>
<Pencil className="h-4 w-4" />
</Button>
- <Button size="icon" variant="danger" title="删除标签" aria-label={`删除标签 ${tag.name}`} onClick={() => handleDelete(tag)}>
+ <Button size="icon" variant="danger" title={t("tagsDialog.deleteTitle")} aria-label={t("tagsDialog.deleteAria", { name: tag.name })} onClick={() => handleDelete(tag)}>
<Trash2 className="h-4 w-4" />
</Button>
</>
@@ -177,9 +179,9 @@ export const TagsDialog = ({ onClose }: { onClose: () => void }) => {
{tagDeleteConfirmation && (
<AppConfirmDialog
- title={`删除标签 #${tagDeleteConfirmation.name}`}
- description={`将从 ${tagDeleteConfirmation.memoCount} 条笔记中移除这个标签,笔记内容不会被删除。`}
- confirmLabel="删除标签"
+ title={t("tagsDialog.deleteConfirmTitle", { name: tagDeleteConfirmation.name })}
+ description={t("tagsDialog.deleteConfirmDescription", { count: tagDeleteConfirmation.memoCount })}
+ confirmLabel={t("tagsDialog.deleteConfirmLabel")}
isWorking={deleteMutation.isPending}
tone="danger"
onCancel={() => setTagDeleteConfirmation(null)}
diff --git a/apps/web/src/components/dialogs/TemplatesDialog.tsx b/apps/web/src/components/dialogs/TemplatesDialog.tsx
index 64d5606f..a582b808 100644
--- a/apps/web/src/components/dialogs/TemplatesDialog.tsx
+++ b/apps/web/src/components/dialogs/TemplatesDialog.tsx
@@ -1,52 +1,8 @@
-import { LayoutList, File as FileIcon, X } from "lucide-react";
-import { Button } from "@/components/ui/button";
+import { useMemo } from "react";
+import { LayoutList, File as FileIcon } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog";
-
-export type MemoTemplate = {
- id: string;
- title: string;
- description: string;
- contentMarkdown: string;
- tags: string[];
-};
-
-export const MEMO_TEMPLATES: MemoTemplate[] = [
- {
- id: "quick-note",
- title: "速记",
- description: "适合临时记录想法、链接和灵感。",
- contentMarkdown: "## 速记\n\n- \n\n## 后续动作\n\n- [ ] ",
- tags: ["template", "quick-note"],
- },
- {
- id: "meeting",
- title: "会议记录",
- description: "议题、结论和待办放在同一页。",
- contentMarkdown: "## 会议记录\n\n时间:\n参与人:\n\n## 议题\n\n- \n\n## 结论\n\n- \n\n## 待办\n\n- [ ] ",
- tags: ["template", "meeting"],
- },
- {
- id: "checklist",
- title: "清单",
- description: "快速列出待办、采购、项目检查项。",
- contentMarkdown: "## 清单\n\n- [ ] \n- [ ] \n- [ ] ",
- tags: ["template", "checklist"],
- },
- {
- id: "reading",
- title: "读书笔记",
- description: "摘录、观点和下一步阅读整理。",
- contentMarkdown: "## 读书笔记\n\n书名:\n作者:\n\n## 摘录\n\n> \n\n## 我的观点\n\n\n## 延伸问题\n\n- ",
- tags: ["template", "reading"],
- },
- {
- id: "daily",
- title: "每日复盘",
- description: "记录今天完成了什么、卡在哪里。",
- contentMarkdown: "## 每日复盘\n\n## 今天完成\n\n- \n\n## 遇到的问题\n\n- \n\n## 明天优先级\n\n- [ ] ",
- tags: ["template", "daily"],
- },
-];
+import { getMemoTemplates, type MemoTemplate } from "@/lib/app-helpers";
export const TemplatesDialog = ({
canCreateMemo,
@@ -59,6 +15,9 @@ export const TemplatesDialog = ({
onClose: () => void;
onCreateMemo: (template: MemoTemplate) => void;
}) => {
+ const { t } = useTranslation();
+ const memoTemplates = useMemo(() => getMemoTemplates(t), [t]);
+
return (
<Dialog open={true} onOpenChange={(open) => { if (!open && !isCreating) onClose(); }}>
<DialogContent className="max-w-[620px] p-0 overflow-hidden border border-slate-200 bg-white shadow-lg rounded-lg">
@@ -66,17 +25,17 @@ export const TemplatesDialog = ({
<div className="min-w-0">
<DialogTitle className="flex items-center gap-2 text-base font-semibold text-slate-950">
<LayoutList className="h-4 w-4 text-emerald-700" />
- 模板
+ {t("templates.title")}
</DialogTitle>
<DialogDescription className="mt-1 text-xs text-slate-500">
- 选择一个模板,直接创建新笔记。
+ {t("templates.description")}
</DialogDescription>
</div>
</DialogHeader>
<div className="max-h-[60vh] overflow-y-auto p-5">
<div className="grid gap-3 sm:grid-cols-2">
- {MEMO_TEMPLATES.map((template) => (
+ {memoTemplates.map((template) => (
<button
key={template.id}
className="group flex min-h-28 flex-col rounded-md border border-slate-200 bg-white p-3 text-left transition hover:border-slate-300 hover:bg-slate-50 disabled:opacity-50"
@@ -94,7 +53,7 @@ export const TemplatesDialog = ({
</div>
{!canCreateMemo && (
<div className="mt-4 rounded-md border border-amber-100 bg-amber-50 px-3 py-2 text-xs text-amber-800">
- 当前无法创建笔记,请先选择可用笔记本。
+ {t("templates.unavailable")}
</div>
)}
</div>
diff --git a/apps/web/src/components/settings/AdvancedPlayCard.tsx b/apps/web/src/components/settings/AdvancedPlayCard.tsx
index efe04eb8..6f471d6c 100644
--- a/apps/web/src/components/settings/AdvancedPlayCard.tsx
+++ b/apps/web/src/components/settings/AdvancedPlayCard.tsx
@@ -1,29 +1,15 @@
import { useState } from "react";
+import { useTranslation } from "react-i18next";
import { ChevronDown, Copy, Sparkles } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { cn } from "@/lib/utils";
import { copyTextToClipboard } from "./settings-utils";
-const ADVANCED_PROMPTS = [
- {
- title: "人物画像",
- prompt:
- "请通过 EdgeEver MCP 读取我的笔记,基于真实笔记内容为我整理一份人物画像。请只根据笔记中的证据判断,不要做心理诊断,不要夸张定性。输出包括:长期关注的主题、做事偏好、能力线索、反复出现的问题、近期动向,并在每条结论后列出相关笔记标题或 memo id。",
- },
- {
- title: "知识图谱",
- prompt:
- "请通过 EdgeEver MCP 读取我的笔记,为我整理一份知识地图。请找出主要知识领域、每个领域下的关键概念、相关笔记、我已经掌握的部分和还需要补齐的问题。输出结构要适合后续继续学习和写作。",
- },
- {
- title: "标签建议",
- prompt:
- "请通过 EdgeEver MCP 读取我的笔记和现有标签,帮我设计一套更清晰的标签体系。请指出重复、过细、过宽或命名不一致的标签,并给出合并、重命名和新增标签建议。先不要修改笔记,等我确认后再执行。",
- },
-] as const;
+const ADVANCED_PROMPT_KEYS = ["persona", "knowledgeMap", "tagAdvice"] as const;
export const AdvancedPlayCard = () => {
+ const { t } = useTranslation();
const [copiedPrompt, setCopiedPrompt] = useState<string | null>(null);
const [expanded, setExpanded] = useState(false);
@@ -50,10 +36,10 @@ export const AdvancedPlayCard = () => {
<span className="min-w-0">
<CardTitle className="flex items-center gap-2 text-sm">
<Sparkles className="h-4 w-4 text-emerald-700" />
- 进阶玩法
+ {t("advancedPlay.title")}
</CardTitle>
<CardDescription className="mt-1 text-xs leading-4">
- 搭配AI Agent的进阶玩法。
+ {t("advancedPlay.description")}
</CardDescription>
</span>
<ChevronDown
@@ -66,24 +52,29 @@ export const AdvancedPlayCard = () => {
</CardHeader>
{expanded && (
<CardContent className="grid gap-3 p-4 pt-0">
- {ADVANCED_PROMPTS.map((item) => (
- <div key={item.title} className="rounded-lg border border-slate-200 bg-white p-3">
+ {ADVANCED_PROMPT_KEYS.map((key) => {
+ const title = t(`advancedPlay.prompts.${key}.title`);
+ const prompt = t(`advancedPlay.prompts.${key}.prompt`);
+
+ return (
+ <div key={key} className="rounded-lg border border-slate-200 bg-white p-3">
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
- <div className="text-sm font-bold text-slate-900">{item.title}</div>
+ <div className="text-sm font-bold text-slate-900">{title}</div>
<Button
size="sm"
variant="outline"
className="h-8 w-full justify-center bg-white px-3 text-xs sm:w-auto"
type="button"
- onClick={() => void handleCopyPrompt(item.title, item.prompt)}
+ onClick={() => void handleCopyPrompt(title, prompt)}
>
<Copy className="h-3.5 w-3.5" />
- {copiedPrompt === item.title ? "已复制" : "复制 Prompt"}
+ {copiedPrompt === title ? t("common.copied") : t("advancedPlay.copyPrompt")}
</Button>
</div>
- <p className="mt-2 text-xs leading-5 text-slate-500">{item.prompt}</p>
+ <p className="mt-2 text-xs leading-5 text-slate-500">{prompt}</p>
</div>
- ))}
+ );
+ })}
</CardContent>
)}
</Card>
diff --git a/apps/web/src/components/settings/EvernoteImportGuideCard.tsx b/apps/web/src/components/settings/EvernoteImportGuideCard.tsx
index 8656f00c..b1805f74 100644
--- a/apps/web/src/components/settings/EvernoteImportGuideCard.tsx
+++ b/apps/web/src/components/settings/EvernoteImportGuideCard.tsx
@@ -1,4 +1,5 @@
import { HelpCircle, UploadCloud } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { EVERNOTE_MIGRATION_PATH } from "@/lib/routes";
@@ -7,40 +8,42 @@ interface EvernoteImportGuideCardProps {
onShowGuide?: () => void;
}
-export const EvernoteImportGuideCard = ({ onShowGuide }: EvernoteImportGuideCardProps) => (
- <Card className="hidden w-full min-w-0 overflow-hidden shadow-none lg:block">
- <CardHeader className="p-4">
- <CardTitle className="flex items-center gap-2 text-sm">
- <UploadCloud className="h-4 w-4 text-emerald-700" />
- 导入印象笔记
- {onShowGuide ? (
- <Button
- size="sm"
- variant="outline"
- className="h-7 bg-white px-2.5 text-xs gap-1"
- type="button"
- onClick={onShowGuide}
- >
- <HelpCircle className="h-3.5 w-3.5" />
- 操作指引
- </Button>
- ) : (
- <Button size="sm" variant="outline" className="h-7 bg-white px-2.5 text-xs" type="button" asChild>
- <a
- href={EVERNOTE_MIGRATION_PATH}
- target="_blank"
- rel="noopener noreferrer"
- aria-label="在新标签页打开印象笔记迁移操作指引"
+export const EvernoteImportGuideCard = ({ onShowGuide }: EvernoteImportGuideCardProps) => {
+ const { t } = useTranslation();
+
+ return (
+ <Card className="hidden w-full min-w-0 overflow-hidden shadow-none lg:block">
+ <CardHeader className="p-4">
+ <CardTitle className="flex items-center gap-2 text-sm">
+ <UploadCloud className="h-4 w-4 text-emerald-700" />
+ {t("evernoteImport.title")}
+ {onShowGuide ? (
+ <Button
+ size="sm"
+ variant="outline"
+ className="h-7 bg-white px-2.5 text-xs gap-1"
+ type="button"
+ onClick={onShowGuide}
>
<HelpCircle className="h-3.5 w-3.5" />
- 操作指引
- </a>
- </Button>
- )}
- </CardTitle>
- <CardDescription className="text-xs leading-4">
- 查看从印象笔记迁移到 EdgeEver 的步骤,推荐使用 MCP 与 AI Agent 批量导入。
- </CardDescription>
- </CardHeader>
- </Card>
-);
+ {t("evernoteImport.guide")}
+ </Button>
+ ) : (
+ <Button size="sm" variant="outline" className="h-7 bg-white px-2.5 text-xs" type="button" asChild>
+ <a
+ href={EVERNOTE_MIGRATION_PATH}
+ target="_blank"
+ rel="noopener noreferrer"
+ aria-label={t("evernoteImport.openGuideAria")}
+ >
+ <HelpCircle className="h-3.5 w-3.5" />
+ {t("evernoteImport.guide")}
+ </a>
+ </Button>
+ )}
+ </CardTitle>
+ <CardDescription className="text-xs leading-4">{t("evernoteImport.description")}</CardDescription>
+ </CardHeader>
+ </Card>
+ );
+};
diff --git a/apps/web/src/components/settings/McpConfigCard.tsx b/apps/web/src/components/settings/McpConfigCard.tsx
index 8feb92c6..c75cd986 100644
--- a/apps/web/src/components/settings/McpConfigCard.tsx
+++ b/apps/web/src/components/settings/McpConfigCard.tsx
@@ -1,5 +1,6 @@
import { useEffect, useState, type FormEvent } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
import { ChevronDown, Copy, KeyRound, Plus, ShieldCheck, Trash2 } from "lucide-react";
import type { ApiToken } from "@edgeever/shared";
import { Button } from "@/components/ui/button";
@@ -23,6 +24,7 @@ interface CreatedTokenNoticeProps {
}
const CreatedTokenNotice = ({ token }: CreatedTokenNoticeProps) => {
+ const { t } = useTranslation();
const [copiedAction, setCopiedAction] = useState<"token" | "config" | null>(null);
const handleCopy = async (action: "token" | "config") => {
@@ -41,7 +43,7 @@ const CreatedTokenNotice = ({ token }: CreatedTokenNoticeProps) => {
<div className="rounded-lg border border-emerald-200 bg-emerald-50/80 p-3">
<div className="mb-3 flex items-center gap-2 text-sm font-semibold text-emerald-900">
<ShieldCheck className="h-4 w-4 text-emerald-700" />
- API Token 已成功生成
+ {t("mcp.createdTitle")}
</div>
<div className="flex flex-col gap-2 xl:flex-row">
<div className="flex h-8 min-w-0 flex-1 items-center rounded-md border border-emerald-200 bg-white px-3 font-mono text-xs text-slate-900">
@@ -55,7 +57,7 @@ const CreatedTokenNotice = ({ token }: CreatedTokenNoticeProps) => {
type="button"
onClick={() => void handleCopy("token")}
>
- {copiedAction === "token" ? "已复制" : "复制 Token"}
+ {copiedAction === "token" ? t("common.copied") : t("mcp.copyToken")}
</Button>
<Button
size="sm"
@@ -64,16 +66,17 @@ const CreatedTokenNotice = ({ token }: CreatedTokenNoticeProps) => {
type="button"
onClick={() => void handleCopy("config")}
>
- {copiedAction === "config" ? "已复制" : "复制完整 MCP 配置"}
+ {copiedAction === "config" ? t("common.copied") : t("mcp.copyConfig")}
</Button>
</div>
</div>
- <p className="mt-2 text-xs font-medium leading-4 text-emerald-800">安全提醒:此 Token 属于高危凭证,请勿对外泄露。</p>
+ <p className="mt-2 text-xs font-medium leading-4 text-emerald-800">{t("mcp.securityWarning")}</p>
</div>
);
};
const McpTitleWithHelp = () => {
+ const { t } = useTranslation();
const baseUrl = getEdgeEverBaseUrl();
const [copied, setCopied] = useState(false);
const remoteExample = JSON.stringify(
@@ -82,7 +85,7 @@ const McpTitleWithHelp = () => {
edgeever: {
url: `${baseUrl}/mcp`,
headers: {
- Authorization: "Bearer 我创建的token",
+ Authorization: t("mcp.bearerPlaceholder"),
},
},
},
@@ -104,16 +107,16 @@ const McpTitleWithHelp = () => {
<div className="w-fit max-w-full">
<CardTitle className="flex items-center gap-2 text-sm">
<KeyRound className="h-4 w-4 text-emerald-700" />
- 生成 MCP 配置
+ {t("mcp.title")}
<Dialog>
<DialogTrigger asChild>
<Button size="sm" variant="outline" className="h-7 bg-white px-2.5 text-xs" type="button">
- 使用示例
+ {t("mcp.example")}
</Button>
</DialogTrigger>
<DialogContent className="max-w-2xl gap-3 p-4 sm:p-5">
<DialogHeader>
- <DialogTitle className="text-base">Remote MCP 示例</DialogTitle>
+ <DialogTitle className="text-base">{t("mcp.exampleTitle")}</DialogTitle>
</DialogHeader>
<pre className="max-h-[55vh] overflow-auto rounded-md border border-slate-100 bg-slate-950 p-3 text-left text-[11px] leading-5 text-slate-100 sm:text-xs">
<code>{remoteExample}</code>
@@ -127,7 +130,7 @@ const McpTitleWithHelp = () => {
onClick={() => void handleCopy()}
>
<Copy className="h-3.5 w-3.5" />
- {copied ? "已复制" : "复制示例"}
+ {copied ? t("common.copied") : t("mcp.copyExample")}
</Button>
</div>
</DialogContent>
@@ -144,6 +147,7 @@ interface ScopePickerProps {
}
const ScopePicker = ({ availableScopes, selectedScopes, onToggleScope }: ScopePickerProps) => {
+ const { t } = useTranslation();
const [expanded, setExpanded] = useState(false);
return (
@@ -155,9 +159,9 @@ const ScopePicker = ({ availableScopes, selectedScopes, onToggleScope }: ScopePi
onClick={() => setExpanded((current) => !current)}
>
<span className="min-w-0">
- <span className="block text-xs font-semibold text-slate-700">Token 权限范围</span>
+ <span className="block text-xs font-semibold text-slate-700">{t("mcp.scopeTitle")}</span>
<span className="mt-0.5 block text-[11px] font-medium text-slate-400">
- 已选择 {selectedScopes.size}/{availableScopes.length}
+ {t("mcp.selectedScopes", { selected: selectedScopes.size, total: availableScopes.length })}
</span>
</span>
<ChevronDown
@@ -191,7 +195,7 @@ const ScopePicker = ({ availableScopes, selectedScopes, onToggleScope }: ScopePi
className="border-emerald-300"
/>
<span className="min-w-0 truncate text-xs font-semibold" title={scope}>
- {getTokenScopeLabel(scope)}
+ {getTokenScopeLabel(scope, t)}
</span>
</label>
);
@@ -210,6 +214,7 @@ interface TokenListProps {
}
const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps) => {
+ const { t } = useTranslation();
const [copiedAction, setCopiedAction] = useState<{ tokenId: string; action: "token" | "config" } | null>(null);
const handleCopy = async (token: ApiToken, action: "token" | "config") => {
@@ -231,7 +236,7 @@ const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps)
if (isLoading) {
return (
<div className="rounded-lg border border-dashed border-slate-200 px-4 py-8 text-center text-sm text-slate-400">
- 正在加载 Token 列表...
+ {t("mcp.loadingTokens")}
</div>
);
}
@@ -239,7 +244,7 @@ const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps)
if (tokens.length === 0) {
return (
<div className="rounded-lg border border-dashed border-slate-200 px-4 py-8 text-center text-sm text-slate-400">
- 暂无活跃的 API Token
+ {t("mcp.emptyTokens")}
</div>
);
}
@@ -260,11 +265,11 @@ const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps)
className="mt-2 block w-fit max-w-full truncate rounded-md border border-slate-100 bg-slate-50 px-2 py-1 text-[11px] font-semibold text-slate-500"
title={token.scopes.join(", ")}
>
- {token.scopes.map(getTokenScopeLabel).join("、") || "无权限"}
+ {token.scopes.map((scope) => getTokenScopeLabel(scope, t)).join("、") || t("mcp.noScope")}
</span>
<span className="mt-2 block text-[11px] font-medium text-slate-400">
- {token.lastUsedAt ? `上次调用时间:${formatDateTime(token.lastUsedAt)}` : "从未被调用"}
- {!token.token ? " · 旧 Token 无法找回明文,请重新生成" : ""}
+ {token.lastUsedAt ? t("mcp.lastUsedAt", { time: formatDateTime(token.lastUsedAt) }) : t("mcp.neverUsed")}
+ {!token.token ? ` · ${t("mcp.legacyTokenHint")}` : ""}
</span>
</span>
<div className="flex shrink-0 flex-col gap-2 sm:flex-row lg:items-center">
@@ -272,8 +277,8 @@ const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps)
size="sm"
variant="outline"
className="h-9 justify-center whitespace-nowrap bg-white px-3 text-xs"
- title={token.token ? "复制 Token" : "旧 Token 无法复制"}
- aria-label={token.token ? "复制 Token" : "旧 Token 无法复制"}
+ title={token.token ? t("mcp.copyToken") : t("mcp.legacyTokenCannotCopy")}
+ aria-label={token.token ? t("mcp.copyToken") : t("mcp.legacyTokenCannotCopy")}
disabled={token.isRevoked || !token.token}
onClick={() => void handleCopy(token, "token")}
>
@@ -282,14 +287,14 @@ const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps)
) : (
<Copy className="h-3.5 w-3.5" />
)}
- {copiedAction?.tokenId === token.id && copiedAction.action === "token" ? "已复制" : "复制 Token"}
+ {copiedAction?.tokenId === token.id && copiedAction.action === "token" ? t("common.copied") : t("mcp.copyToken")}
</Button>
<Button
size="sm"
variant="outline"
className="h-9 justify-center whitespace-nowrap bg-white px-3 text-xs"
- title={token.token ? "复制完整 MCP 配置" : "旧 Token 无法复制 MCP 配置"}
- aria-label={token.token ? "复制完整 MCP 配置" : "旧 Token 无法复制 MCP 配置"}
+ title={token.token ? t("mcp.copyConfig") : t("mcp.legacyConfigCannotCopy")}
+ aria-label={token.token ? t("mcp.copyConfig") : t("mcp.legacyConfigCannotCopy")}
disabled={token.isRevoked || !token.token}
onClick={() => void handleCopy(token, "config")}
>
@@ -298,14 +303,14 @@ const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps)
) : (
<Copy className="h-3.5 w-3.5" />
)}
- {copiedAction?.tokenId === token.id && copiedAction.action === "config" ? "已复制" : "复制完整 MCP 配置"}
+ {copiedAction?.tokenId === token.id && copiedAction.action === "config" ? t("common.copied") : t("mcp.copyConfig")}
</Button>
<Button
size="icon"
variant="danger"
className="h-9 w-full shrink-0 sm:w-9"
- title="删除 Token"
- aria-label="删除 Token"
+ title={t("mcp.deleteToken")}
+ aria-label={t("mcp.deleteToken")}
disabled={token.isRevoked || isDeleting}
onClick={() => onDelete(token)}
>
@@ -319,6 +324,7 @@ const TokenList = ({ tokens, isLoading, isDeleting, onDelete }: TokenListProps)
};
export const McpConfigCard = () => {
+ const { t } = useTranslation();
const queryClient = useQueryClient();
const [name, setName] = useState("MCP Agent");
const [selectedScopes, setSelectedScopes] = useState<Set<string>>(() => new Set(ALL_TOKEN_SCOPES));
@@ -388,7 +394,7 @@ export const McpConfigCard = () => {
<Card className="w-full min-w-0 overflow-hidden shadow-none">
<CardHeader className="p-4">
<McpTitleWithHelp />
- <CardDescription className="text-xs leading-4">让 AI Agent 可以读取和整理你的笔记。</CardDescription>
+ <CardDescription className="text-xs leading-4">{t("mcp.description")}</CardDescription>
</CardHeader>
<CardContent className="space-y-4 p-4 pt-0">
{createdToken && <CreatedTokenNotice token={createdToken.token} />}
@@ -399,7 +405,7 @@ export const McpConfigCard = () => {
className="h-9 min-w-0 flex-1 text-xs focus-visible:ring-4 focus-visible:ring-emerald-500/10"
value={name}
onChange={(event) => setName(event.target.value)}
- placeholder="Token 用途,例如:MCP Agent"
+ placeholder={t("mcp.namePlaceholder")}
/>
<Button
size="md"
@@ -409,7 +415,7 @@ export const McpConfigCard = () => {
disabled={createMutation.isPending}
>
<Plus className="h-4 w-4" />
- 生成 Token
+ {t("mcp.createToken")}
</Button>
</div>
@@ -421,7 +427,7 @@ export const McpConfigCard = () => {
</form>
<div className="space-y-3">
- <span className="block text-xs font-semibold text-slate-500">活跃 Token</span>
+ <span className="block text-xs font-semibold text-slate-500">{t("mcp.activeTokens")}</span>
<TokenList
tokens={tokens}
isLoading={tokensQuery.isLoading}
@@ -434,9 +440,9 @@ export const McpConfigCard = () => {
{tokenDeleteConfirmation && (
<AppConfirmDialog
- title={`确定要删除 Token「${tokenDeleteConfirmation.name}」吗?`}
- description="删除操作不可逆。一旦删除,使用此 Token 进行 API 或 MCP 调用的一切客户端将立即失效并被拒绝访问。"
- confirmLabel="确认删除"
+ title={t("mcp.deleteConfirmTitle", { name: tokenDeleteConfirmation.name })}
+ description={t("mcp.deleteConfirmDescription")}
+ confirmLabel={t("mcp.deleteConfirmLabel")}
isWorking={deleteTokenMutation.isPending}
tone="danger"
onCancel={() => setTokenDeleteConfirmation(null)}
diff --git a/apps/web/src/components/settings/PreferenceCard.tsx b/apps/web/src/components/settings/PreferenceCard.tsx
index 85ed81f9..6fc65212 100644
--- a/apps/web/src/components/settings/PreferenceCard.tsx
+++ b/apps/web/src/components/settings/PreferenceCard.tsx
@@ -1,7 +1,10 @@
import { Image } from "lucide-react";
+import { useTranslation } from "react-i18next";
import type { ShortcutSettings } from "@/lib/app-helpers";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
+import { changeAppLocale, defaultLocale, localeLabels, supportedLocales, type SupportedLocale } from "@/i18n";
import { ShortcutSettingsItem } from "./ShortcutSettingsItem";
interface PreferenceCardProps {
@@ -16,32 +19,60 @@ export const PreferenceCard = ({
onImageCompressionChange,
shortcutSettings,
onShortcutSettingsChange,
-}: PreferenceCardProps) => (
- <Card className="w-full min-w-0 overflow-hidden shadow-none">
- <CardHeader className="p-4">
- <CardTitle className="flex items-center gap-2 text-sm">
- <Image className="h-4 w-4 text-emerald-700" />
- 偏好设置
- </CardTitle>
- </CardHeader>
- <CardContent className="grid gap-3 p-4 pt-0">
- <div className="flex min-h-14 flex-col items-start gap-3 rounded-lg border border-slate-100 bg-slate-50/70 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
- <div className="min-w-0">
- <div className="text-sm font-semibold text-slate-900">压缩笔记内图片</div>
- <div className="mt-0.5 text-xs leading-4 text-slate-500">上传大图时在本地压缩,节省资源占用。</div>
+}: PreferenceCardProps) => {
+ const { i18n, t } = useTranslation();
+ const activeLocale = supportedLocales.includes(i18n.resolvedLanguage as SupportedLocale)
+ ? (i18n.resolvedLanguage as SupportedLocale)
+ : defaultLocale;
+
+ return (
+ <Card className="w-full min-w-0 overflow-hidden shadow-none">
+ <CardHeader className="p-4">
+ <CardTitle className="flex items-center gap-2 text-sm">
+ <Image className="h-4 w-4 text-emerald-700" />
+ {t("settings.preferences")}
+ </CardTitle>
+ </CardHeader>
+ <CardContent className="grid gap-3 p-4 pt-0">
+ <div className="flex min-h-14 flex-col items-start gap-3 rounded-lg border border-slate-100 bg-slate-50/70 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
+ <div className="min-w-0">
+ <div className="text-sm font-semibold text-slate-900">{t("settings.languageTitle")}</div>
+ <div className="mt-0.5 text-xs leading-4 text-slate-500">{t("settings.languageDescription")}</div>
+ </div>
+ <div className="w-full shrink-0 sm:w-44">
+ <Select value={activeLocale} onValueChange={(locale) => void changeAppLocale(locale as SupportedLocale)}>
+ <SelectTrigger aria-label={t("common.language")} className="h-9 bg-white">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {supportedLocales.map((locale) => (
+ <SelectItem key={locale} value={locale}>
+ {localeLabels[locale]}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
</div>
- <div className="flex w-full shrink-0 justify-start sm:w-32">
- <Switch
- checked={imageCompressionEnabled}
- onCheckedChange={onImageCompressionChange}
- aria-label="是否压缩笔记内图片"
- />
+
+ <div className="flex min-h-14 flex-col items-start gap-3 rounded-lg border border-slate-100 bg-slate-50/70 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
+ <div className="min-w-0">
+ <div className="text-sm font-semibold text-slate-900">{t("settings.imageCompressionTitle")}</div>
+ <div className="mt-0.5 text-xs leading-4 text-slate-500">{t("settings.imageCompressionDescription")}</div>
+ </div>
+ <div className="flex w-full shrink-0 justify-start sm:w-32">
+ <Switch
+ checked={imageCompressionEnabled}
+ onCheckedChange={onImageCompressionChange}
+ aria-label={t("settings.imageCompressionAria")}
+ />
+ </div>
</div>
- </div>
- <ShortcutSettingsItem
- shortcutSettings={shortcutSettings}
- onShortcutSettingsChange={onShortcutSettingsChange}
- />
- </CardContent>
- </Card>
-);
+ <ShortcutSettingsItem
+ shortcutSettings={shortcutSettings}
+ onShortcutSettingsChange={onShortcutSettingsChange}
+ />
+ </CardContent>
+ </Card>
+ );
+};
diff --git a/apps/web/src/components/settings/SessionCard.tsx b/apps/web/src/components/settings/SessionCard.tsx
index b66cf8e7..a36f9ba7 100644
--- a/apps/web/src/components/settings/SessionCard.tsx
+++ b/apps/web/src/components/settings/SessionCard.tsx
@@ -1,4 +1,5 @@
import { LogOut } from "lucide-react";
+import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
@@ -9,6 +10,8 @@ interface SessionCardProps {
}
export const SessionCard = ({ authRequired, isLoggingOut, onLogout }: SessionCardProps) => {
+ const { t } = useTranslation();
+
if (!authRequired) {
return null;
}
@@ -24,7 +27,7 @@ export const SessionCard = ({ authRequired, isLoggingOut, onLogout }: SessionCar
onClick={onLogout}
>
<LogOut className="h-4 w-4" />
- {isLoggingOut ? "安全退出中..." : "退出登录"}
+ {isLoggingOut ? t("session.loggingOut") : t("session.logout")}
</Button>
</CardContent>
</Card>
diff --git a/apps/web/src/components/settings/ShortcutSettingsItem.tsx b/apps/web/src/components/settings/ShortcutSettingsItem.tsx
index e0557438..72f0b41a 100644
--- a/apps/web/src/components/settings/ShortcutSettingsItem.tsx
+++ b/apps/web/src/components/settings/ShortcutSettingsItem.tsx
@@ -1,12 +1,13 @@
import { useEffect, useMemo, useRef, useState } from "react";
import { Keyboard, RotateCcw } from "lucide-react";
+import { useTranslation } from "react-i18next";
import type { ShortcutAction, ShortcutBinding, ShortcutSettings } from "@/lib/app-helpers";
import {
DEFAULT_SHORTCUT_SETTINGS,
formatShortcutBinding,
+ getShortcutActionOptions,
shortcutBindingFromKeyboardEvent,
shortcutBindingsEqual,
- SHORTCUT_ACTION_OPTIONS,
} from "@/lib/app-helpers";
import { Button } from "@/components/ui/button";
import {
@@ -27,21 +28,24 @@ interface ShortcutSettingsItemProps {
const getConflictAction = (
action: ShortcutAction,
binding: ShortcutBinding,
- settings: ShortcutSettings
-) => SHORTCUT_ACTION_OPTIONS.find((item) => item.value !== action && shortcutBindingsEqual(settings[item.value], binding));
+ settings: ShortcutSettings,
+ shortcutActionOptions: ReturnType<typeof getShortcutActionOptions>
+) => shortcutActionOptions.find((item) => item.value !== action && shortcutBindingsEqual(settings[item.value], binding));
export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChange }: ShortcutSettingsItemProps) => {
+ const { t } = useTranslation();
const [shortcutsOpen, setShortcutsOpen] = useState(false);
const [recordingAction, setRecordingAction] = useState<ShortcutAction | null>(null);
const [captureMessage, setCaptureMessage] = useState("");
const captureButtonRef = useRef<HTMLButtonElement | null>(null);
+ const shortcutActionOptions = useMemo(() => getShortcutActionOptions(t), [t]);
const shortcutSummary = useMemo(
() =>
- SHORTCUT_ACTION_OPTIONS.map((item) => formatShortcutBinding(shortcutSettings[item.value]))
+ shortcutActionOptions.map((item) => formatShortcutBinding(shortcutSettings[item.value]))
.slice(0, 3)
.join(" / "),
- [shortcutSettings]
+ [shortcutActionOptions, shortcutSettings]
);
useEffect(() => {
@@ -69,13 +73,13 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChang
const nextBinding = shortcutBindingFromKeyboardEvent(event);
if (!nextBinding) {
- setCaptureMessage("请按下包含 Ctrl、⌘ 或 Alt 的组合键。");
+ setCaptureMessage(t("shortcuts.requireModifier"));
return;
}
- const conflictAction = getConflictAction(recordingAction, nextBinding, shortcutSettings);
+ const conflictAction = getConflictAction(recordingAction, nextBinding, shortcutSettings, shortcutActionOptions);
if (conflictAction) {
- setCaptureMessage(`这个组合键已用于「${conflictAction.label}」。`);
+ setCaptureMessage(t("shortcuts.conflict", { label: conflictAction.label }));
return;
}
@@ -89,7 +93,7 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChang
window.addEventListener("keydown", handleKeyDown, { capture: true });
return () => window.removeEventListener("keydown", handleKeyDown, { capture: true });
- }, [onShortcutSettingsChange, recordingAction, shortcutSettings]);
+ }, [onShortcutSettingsChange, recordingAction, shortcutActionOptions, shortcutSettings, t]);
const handleResetShortcuts = () => {
onShortcutSettingsChange(DEFAULT_SHORTCUT_SETTINGS);
@@ -103,7 +107,7 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChang
<div className="min-w-0">
<div className="flex items-center gap-2 text-sm font-semibold text-slate-900">
<Keyboard className="h-4 w-4 text-emerald-700" />
- 绑定快捷键
+ {t("shortcuts.title")}
</div>
<div className="mt-0.5 truncate text-xs leading-4 text-slate-500">{shortcutSummary}</div>
</div>
@@ -114,7 +118,7 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChang
type="button"
onClick={() => setShortcutsOpen(true)}
>
- 管理
+ {t("shortcuts.manage")}
</Button>
</div>
@@ -123,13 +127,13 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChang
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<Keyboard className="h-5 w-5 text-emerald-700" />
- 绑定快捷键
+ {t("shortcuts.title")}
</DialogTitle>
- <DialogDescription>为常用笔记动作设置组合键。按 Esc 可取消当前录制。</DialogDescription>
+ <DialogDescription>{t("shortcuts.description")}</DialogDescription>
</DialogHeader>
<div className="grid gap-3">
- {SHORTCUT_ACTION_OPTIONS.map((item) => {
+ {shortcutActionOptions.map((item) => {
const recording = recordingAction === item.value;
return (
@@ -151,7 +155,7 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChang
setCaptureMessage("");
}}
>
- {recording ? "输入组合键" : formatShortcutBinding(shortcutSettings[item.value])}
+ {recording ? t("shortcuts.recording") : formatShortcutBinding(shortcutSettings[item.value])}
</Button>
</div>
);
@@ -167,7 +171,7 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChang
<DialogFooter>
<Button type="button" variant="outline" onClick={handleResetShortcuts}>
<RotateCcw className="h-4 w-4" />
- 恢复默认
+ {t("shortcuts.reset")}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/apps/web/src/components/settings/settings-utils.ts b/apps/web/src/components/settings/settings-utils.ts
index 909ca4f8..08086400 100644
--- a/apps/web/src/components/settings/settings-utils.ts
+++ b/apps/web/src/components/settings/settings-utils.ts
@@ -1,13 +1,4 @@
-const TOKEN_SCOPE_LABELS: Record<string, string> = {
- "read:notebooks": "读取笔记本",
- "write:notebooks": "创建与修改笔记本",
- "read:memos": "读取笔记",
- "write:memos": "创建与修改笔记",
- "read:resources": "读取附件资源",
- "write:resources": "上传与修改附件",
- "read:tags": "读取标签",
- "write:tags": "创建与修改标签",
-};
+import type { TFunction } from "i18next";
export const ALL_TOKEN_SCOPES = [
"read:notebooks",
@@ -20,7 +11,7 @@ export const ALL_TOKEN_SCOPES = [
"write:tags",
];
-export const getTokenScopeLabel = (scope: string) => TOKEN_SCOPE_LABELS[scope] ?? scope;
+export const getTokenScopeLabel = (scope: string, t: TFunction) => t(`mcp.scopes.${scope}`, { defaultValue: scope });
export const copyTextToClipboard = async (text: string) => {
if (navigator.clipboard?.writeText) {
diff --git a/apps/web/src/i18n/index.ts b/apps/web/src/i18n/index.ts
new file mode 100644
index 00000000..88adeef1
--- /dev/null
+++ b/apps/web/src/i18n/index.ts
@@ -0,0 +1,38 @@
+import i18n from "i18next";
+import { initReactI18next } from "react-i18next";
+import { defaultLocale, getInitialLocale, supportedLocales, writeStoredLocale, type SupportedLocale } from "./locales";
+import { enUS } from "./resources/en-US";
+import { zhCN } from "./resources/zh-CN";
+
+export { defaultLocale, localeLabels, supportedLocales, type SupportedLocale } from "./locales";
+
+export const resources = {
+ "zh-CN": { translation: zhCN },
+ "en-US": { translation: enUS },
+} as const;
+
+void i18n.use(initReactI18next).init({
+ resources,
+ lng: getInitialLocale(),
+ fallbackLng: defaultLocale,
+ supportedLngs: supportedLocales,
+ interpolation: {
+ escapeValue: false,
+ },
+ returnNull: false,
+});
+
+i18n.on("languageChanged", (locale) => {
+ const supported = supportedLocales.find((item) => item === locale);
+
+ if (supported) {
+ writeStoredLocale(supported);
+ document.documentElement.lang = supported;
+ }
+});
+
+document.documentElement.lang = i18n.resolvedLanguage ?? i18n.language ?? defaultLocale;
+
+export const changeAppLocale = (locale: SupportedLocale) => i18n.changeLanguage(locale);
+
+export default i18n;
diff --git a/apps/web/src/i18n/locales.ts b/apps/web/src/i18n/locales.ts
new file mode 100644
index 00000000..608a395c
--- /dev/null
+++ b/apps/web/src/i18n/locales.ts
@@ -0,0 +1,62 @@
+export const supportedLocales = ["zh-CN", "en-US"] as const;
+
+export type SupportedLocale = (typeof supportedLocales)[number];
+
+export const defaultLocale: SupportedLocale = "zh-CN";
+
+export const localeStorageKey = "edgeever.locale";
+
+export const localeLabels: Record<SupportedLocale, string> = {
+ "zh-CN": "简体中文",
+ "en-US": "English",
+};
+
+export const normalizeLocale = (locale: string | null | undefined): SupportedLocale | null => {
+ if (!locale) {
+ return null;
+ }
+
+ const normalized = locale.toLowerCase();
+
+ if (normalized === "zh" || normalized === "zh-cn" || normalized.startsWith("zh-hans")) {
+ return "zh-CN";
+ }
+
+ if (normalized === "en" || normalized === "en-us" || normalized.startsWith("en-")) {
+ return "en-US";
+ }
+
+ return null;
+};
+
+export const readStoredLocale = (): SupportedLocale | null => {
+ try {
+ return normalizeLocale(window.localStorage.getItem(localeStorageKey));
+ } catch {
+ return null;
+ }
+};
+
+export const writeStoredLocale = (locale: SupportedLocale) => {
+ try {
+ window.localStorage.setItem(localeStorageKey, locale);
+ } catch {
+ // Local storage can be unavailable in private or restricted browser contexts.
+ }
+};
+
+export const getBrowserLocale = (): SupportedLocale | null => {
+ const browserLocales = navigator.languages?.length ? navigator.languages : [navigator.language];
+
+ for (const locale of browserLocales) {
+ const supported = normalizeLocale(locale);
+
+ if (supported) {
+ return supported;
+ }
+ }
+
+ return null;
+};
+
+export const getInitialLocale = () => readStoredLocale() ?? getBrowserLocale() ?? defaultLocale;
diff --git a/apps/web/src/i18n/resources/en-US.ts b/apps/web/src/i18n/resources/en-US.ts
new file mode 100644
index 00000000..4055e615
--- /dev/null
+++ b/apps/web/src/i18n/resources/en-US.ts
@@ -0,0 +1,574 @@
+export const enUS = {
+ common: {
+ appName: "EdgeEver",
+ close: "Close",
+ cancel: "Cancel",
+ save: "Save",
+ delete: "Delete",
+ loading: "Loading",
+ back: "Go back",
+ language: "Language",
+ untitledMemo: "Untitled note",
+ processing: "Processing",
+ saving: "Saving",
+ copied: "Copied",
+ githubRepository: "GitHub repository",
+ },
+ dialogs: {
+ memoDelete: {
+ permanentBulkTitle: "Delete {{count}} notes permanently",
+ permanentSingleTitle: "Delete note permanently",
+ softBulkTitle: "Delete {{count}} notes",
+ softSingleTitle: "Delete note",
+ permanentDescription: "This action cannot be undone.",
+ softDescription: "Deleted notes can be restored from Trash.",
+ permanentConfirm: "Delete permanently",
+ softConfirm: "Delete",
+ },
+ notebookName: {
+ createTitle: "New notebook",
+ renameTitle: "Rename notebook",
+ createDescription: "Create a new notebook to organize related notes.",
+ renameDescription: "Changes sync to the notebook tree immediately.",
+ nameLabel: "Name",
+ namePlaceholder: "Notebook name",
+ createSubmit: "Create",
+ },
+ },
+ login: {
+ title: "Sign in to EdgeEver",
+ subtitle: "Self-hosted notes workspace",
+ username: "Username",
+ password: "Password",
+ submitting: "Signing in...",
+ submit: "Open workspace",
+ },
+ nav: {
+ mobileMain: "Mobile primary navigation",
+ home: "Home",
+ mine: "Me",
+ createMemo: "New note",
+ createDisabled: "You cannot create a note in this view",
+ creating: "Creating",
+ },
+ workspace: {
+ inboxDeleteTitle: "Inbox cannot be deleted",
+ inboxDeleteDescription: "Inbox is the default notebook, so new notes always have a home.",
+ selection: {
+ pin: "Pin",
+ unpin: "Unpin",
+ chooseMemo: "Select a note",
+ trashCannotPin: "Notes in trash cannot be pinned",
+ updatingPin: "Updating pin",
+ trashCannotMove: "Notes in trash cannot be moved",
+ noMovableNotebook: "No notebook available",
+ moving: "Moving",
+ move: "Move",
+ needTwoMemos: "Select at least 2 notes",
+ trashCannotMerge: "Notes in trash cannot be merged",
+ merging: "Merging",
+ merge: "Merge notes",
+ deleting: "Deleting",
+ permanentDelete: "Delete permanently",
+ delete: "Delete",
+ },
+ loading: {
+ notebooks: "Loading notebooks",
+ settings: "Loading profile",
+ assets: "Loading resources",
+ migration: "Loading migration guide",
+ editor: "Loading editor",
+ },
+ pullToRefresh: {
+ refreshingNotes: "Fetching latest notes",
+ refreshingPage: "Refreshing page",
+ releaseNotes: "Release to refresh",
+ releasePage: "Release to refresh page",
+ pullNotes: "Pull to refresh",
+ pullPage: "Pull to refresh page",
+ },
+ },
+ notebookPane: {
+ notebooks: "Notebooks",
+ workspaceFallback: "Edge notes workspace",
+ backToList: "Back to note list",
+ newNotebook: "New notebook",
+ newMemo: "New note",
+ entries: "Note entries",
+ allMemos: "All notes",
+ sortTitle: "Notebook sort: {{label}}",
+ loading: "Loading",
+ secondaryEntries: "Secondary entries",
+ profile: "Profile",
+ trash: "Trash",
+ emptyTrash: "Empty trash",
+ empty: "Empty",
+ syncNow: "Sync now",
+ sync: {
+ offlineWithPending: "Offline, {{count}} pending",
+ offline: "Offline",
+ syncing: "Syncing",
+ conflicts: "{{count}} sync conflicts",
+ retry: "{{count}} waiting to retry",
+ pending: "{{count}} pending",
+ synced: "Synced",
+ },
+ },
+ notebookTree: {
+ dragNotebook: "Move notebook “{{name}}”",
+ expandCollapse: "Expand/collapse",
+ collapse: "Collapse {{name}}",
+ expand: "Expand {{name}}",
+ current: "Current: {{name}}",
+ switchTo: "Switch to {{name}}",
+ newChild: "New child notebook",
+ newChildAria: "Create child notebook under {{name}}",
+ rename: "Rename",
+ renameNotebook: "Rename notebook",
+ renameAria: "Rename {{name}}",
+ deleteNotebook: "Delete notebook",
+ deleteAria: "Delete {{name}}",
+ },
+ settings: {
+ title: "Me",
+ subtitle: "Preferences, MCP tokens, and sign-in session",
+ preferences: "Preferences",
+ languageTitle: "Interface language",
+ languageDescription: "Change the display language for the product UI.",
+ imageCompressionTitle: "Compress note images",
+ imageCompressionDescription: "Compress large images locally before upload to reduce storage use.",
+ imageCompressionAria: "Compress note images",
+ },
+ shortcuts: {
+ title: "Keyboard shortcuts",
+ manage: "Manage",
+ description: "Set key combinations for common note actions. Press Esc to cancel recording.",
+ recording: "Press shortcut",
+ reset: "Restore defaults",
+ requireModifier: "Press a shortcut that includes Ctrl, ⌘, or Alt.",
+ conflict: "This shortcut is already used by “{{label}}”.",
+ actions: {
+ createMemo: {
+ label: "New note",
+ description: "Create a new note in the current notebook.",
+ },
+ createNotebook: {
+ label: "New notebook",
+ description: "Create a new notebook at the current level.",
+ },
+ focusSearch: {
+ label: "Search notes",
+ description: "Open search or focus search within the current note.",
+ },
+ focusReplace: {
+ label: "Replace text",
+ description: "Open replace in the current note.",
+ },
+ },
+ },
+ options: {
+ memoDensity: {
+ preview: "Preview list",
+ compact: "Compact list",
+ },
+ memoSort: {
+ updatedDesc: "Recently updated",
+ createdDesc: "Created time",
+ titleAsc: "Title A-Z",
+ },
+ notebookSort: {
+ nameAsc: "Name",
+ memoCountDesc: "Note count",
+ updatedDesc: "Updated date",
+ },
+ memoFilter: {
+ all: "All",
+ pinned: "Pinned",
+ tagged: "Tagged",
+ untagged: "Untagged",
+ },
+ },
+ mobileSheets: {
+ selectionCount: "{{count}} selected",
+ selectMemo: "Select notes",
+ listOptions: "List options",
+ displayMode: "Display mode",
+ sortMode: "Sort by",
+ tags: "Tags",
+ assets: "Attachments",
+ emptyTrash: "Empty trash",
+ trash: "Trash",
+ moveToNotebook: "Move to notebook",
+ searchNotebook: "Search notebooks",
+ noNotebookFound: "No notebooks found",
+ currentTarget: "Current target: {{name}}",
+ moveTo: "Move to {{name}}",
+ bulkActions: "Bulk actions",
+ mergeMemos: "Merge notes",
+ clearSelection: "Clear selection",
+ more: "More",
+ },
+ memoList: {
+ selectionCount: "{{count}} selected",
+ selectMemo: "Select notes",
+ selectedListNone: "Deselect current list",
+ selectedListAll: "Select current list",
+ noSelectableInList: "No selectable notes in the current list",
+ chooseNotebook: "Choose notebook",
+ move: "Move",
+ mergeMemos: "Merge notes",
+ permanentDelete: "Delete permanently",
+ clearSelection: "Clear selection",
+ cancelSearch: "Exit search",
+ searchPlaceholder: "Search notes",
+ clearSearch: "Clear search",
+ cancel: "Cancel",
+ switchNotebook: "Switch notebook",
+ bulkActions: "Bulk actions",
+ listOptions: "List options",
+ filterTitle: "Filter: {{label}}",
+ sortTitle: "Sort: {{label}}",
+ previewList: "Preview list",
+ compactList: "Compact list",
+ emptyTrashTitle: "Empty trash. This cannot be undone",
+ emptyTrash: "Empty",
+ more: "More",
+ moreActions: "More list actions",
+ tags: "Tags",
+ assets: "Attachments",
+ trash: "Trash",
+ currentNotebook: "Current notebook",
+ allNotebooks: "All notebooks",
+ deletedMemos: "Deleted notes",
+ allMemos: "All notes",
+ memoCount: "{{count}} notes",
+ deletedCount: "{{count}} deleted",
+ constrainedCount: "{{label}} · {{count}} notes",
+ searchConstraint: "Search “{{query}}”",
+ filterConstraint: "Filter: {{label}}",
+ reset: "Reset",
+ fetchingLatest: "Fetching latest notes",
+ fetchEmptyTitle: "No notes fetched yet",
+ fetchEmptyDescription: "Network or PWA background recovery may have briefly interrupted sync. This is not treated as an empty notebook.",
+ retry: "Retry",
+ trashEmptyTitle: "Trash is empty",
+ emptyTitle: "No notes yet",
+ noFilteredTitle: "No notes match the filter",
+ trashEmptyDescription: "Deleted notes will appear here.",
+ emptyDescription: "Create a note first, then preview, search, and organize notes here.",
+ noFilteredDescription: "Try another filter or adjust your search keywords.",
+ newMemo: "New note",
+ loadingMore: "Loading more notes",
+ openMemo: "Open note",
+ unpin: "Unpin",
+ pinMemo: "Pin note",
+ restoreMemo: "Restore note",
+ moveToNotebook: "Move to notebook",
+ deleteMemo: "Delete note",
+ toggleOffFilter: "Cancel {{label}}",
+ },
+ memoCard: {
+ yesterday: "Yesterday",
+ emptyMemo: "Empty note",
+ select: "Select {{title}}",
+ unselect: "Deselect {{title}}",
+ dragMany: "Move {{count}} notes",
+ dragOne: "Move “{{title}}”",
+ interactionHint: "Ctrl/Cmd click to toggle selection, Shift click for range selection, drag to a notebook on the left to move, long press on mobile to select",
+ moreActions: "More actions",
+ restoreMemo: "Restore note",
+ deleteMemo: "Delete note",
+ },
+ assets: {
+ uploadNth: "Uploading file {{current}}/{{total}}...",
+ compressingFile: "Compressing: {{filename}}",
+ uploadingFile: "Uploading: {{filename}}",
+ title: "Attachment manager",
+ fileCount: "{{count}} files",
+ imageCount: "{{count}} images",
+ filters: {
+ all: "All",
+ image: "Images",
+ document: "Documents",
+ other: "Other",
+ },
+ searchPlaceholder: "Search attachment names or source notes...",
+ gridView: "Grid view",
+ listView: "List view",
+ activeMemo: "Current note: “{{title}}”",
+ unnamedMemo: "Untitled note",
+ unnamedShort: "Untitled",
+ uploadAttachment: "Upload attachment",
+ processing: "Processing...",
+ noActiveMemoHint: "Tip: open a note in the editor on the right to drag or upload new files here.",
+ loading: "Loading attachments...",
+ noMatches: "No matching attachments",
+ empty: "No attachments yet",
+ noMatchesDescription: "Try changing the search term or category filter",
+ emptyDescription: "Drag files here, or upload files above",
+ previewImage: "Preview image",
+ downloadOpen: "Download/open",
+ deletedMemo: "Deleted note",
+ fromMemo: "From: {{source}}",
+ sourceMemo: "Source note: {{source}}",
+ openInNewWindow: "Open in new window",
+ dropTitle: "Release files here",
+ dropDescription: "Files will be uploaded and attached to the note currently being edited:",
+ uploadSuccess: "Upload complete",
+ uploadError: "Upload failed. Please try again later",
+ },
+ tagsDialog: {
+ title: "Tags",
+ count: "{{count}} tags",
+ loading: "Loading",
+ empty: "No tags yet",
+ nameLabel: "Tag name",
+ memoCount: "{{count}} notes",
+ renameTitle: "Rename tag",
+ renameAria: "Rename tag {{name}}",
+ deleteTitle: "Delete tag",
+ deleteAria: "Delete tag {{name}}",
+ deleteConfirmTitle: "Delete tag #{{name}}",
+ deleteConfirmDescription: "This tag will be removed from {{count}} notes. Note content will not be deleted.",
+ deleteConfirmLabel: "Delete tag",
+ },
+ revisions: {
+ emptyMemo: "Empty note",
+ title: "Version history",
+ loading: "Loading",
+ empty: "No previous versions",
+ changedLines: "{{count}} changed lines",
+ noRevisionSelected: "No revision selected",
+ restoreVersion: "Restore this version",
+ historyVersion: "Historical version",
+ currentContent: "Current content",
+ restoreConfirmTitle: "Restore this historical version",
+ restoreConfirmDescription: "The current content will be replaced by this historical version, and a new revision will still be created.",
+ restoreConfirmLabel: "Restore",
+ },
+ editor: {
+ imageScale: "Image scale",
+ scaleTo: "Scale to {{percent}}%",
+ resizeImage: "Drag to resize image width",
+ currentNotebook: "Current notebook",
+ close: "Close",
+ searchNotebook: "Search notebooks",
+ noNotebookFound: "No notebooks found",
+ currentNotebookAria: "Current notebook: {{name}}",
+ switchToNotebook: "Switch to {{name}}",
+ attachmentInsertText: "Attachment: {{filename}} {{url}}",
+ placeholder: "Start writing...",
+ loading: "Loading",
+ emptySelection: "Select or create a note",
+ saveState: {
+ saving: "Saving",
+ saved: "Saved",
+ queued: "Queued",
+ conflict: "Conflict",
+ error: "Save failed",
+ unsaved: "Unsaved",
+ },
+ uploadState: {
+ failed: "Upload failed",
+ compressing: "Compressing",
+ uploading: "Uploading",
+ fileFailed: "File upload failed",
+ imageCompressing: "Compressing image",
+ fileUploading: "Uploading file",
+ },
+ notebookFallback: "Notebook",
+ saveAndBack: "Save and return to list",
+ backToList: "Back to list",
+ previousMemo: "Previous note",
+ nextMemo: "Next note",
+ updatedAt: "Updated {{time}}",
+ done: "Done",
+ uploadAttachment: "Upload attachment",
+ collapseFormat: "Collapse formatting",
+ format: "Format",
+ searchCurrentMemo: "Search current note",
+ replaceCurrentMemo: "Replace in current note",
+ versionHistory: "Version history",
+ save: "Save",
+ more: "More",
+ moreAria: "More note actions",
+ restoreMemo: "Restore note",
+ deleteForever: "Delete permanently",
+ deleteMemo: "Delete note",
+ notebookPlaceholder: "Current notebook",
+ tagPlaceholder: "Add tags, separated by commas",
+ searchPlaceholder: "Search in current note",
+ replacePlaceholder: "Replace with",
+ previousSearchResult: "Previous search result",
+ nextSearchResult: "Next search result",
+ replaceAll: "Replace all",
+ closeSearch: "Close search",
+ editMemo: "Edit note",
+ },
+ editorToolbar: {
+ toolbar: "Editor toolbar",
+ paragraph: "Body",
+ heading1: "Heading 1",
+ heading2: "Heading 2",
+ heading3: "Heading 3",
+ undo: "Undo",
+ redo: "Redo",
+ bold: "Bold",
+ italic: "Italic",
+ strike: "Strikethrough",
+ inlineCode: "Inline code",
+ bulletList: "Bulleted list",
+ orderedList: "Numbered list",
+ quote: "Quote",
+ codeBlock: "Code block",
+ horizontalRule: "Divider",
+ },
+ mobileNotebookPicker: {
+ title: "Switch notebook",
+ current: "Current: {{name}}",
+ allMemos: "All notes",
+ notebookFallback: "Notebook",
+ searchPlaceholder: "Search notebooks",
+ clearSearch: "Clear search",
+ currentAll: "Current: all notes",
+ switchAll: "Switch to all notes",
+ matchedNotebooks: "Matching notebooks",
+ notebooks: "Notebooks",
+ collapseAllAria: "Collapse all notebooks",
+ expandAllAria: "Expand all notebooks",
+ collapseAll: "Collapse all",
+ expandAll: "Expand all",
+ noSearchResult: "No results for “{{query}}”",
+ noNotebook: "No notebooks found",
+ showAll: "Show all notebooks",
+ collapse: "Collapse {{name}}",
+ expand: "Expand {{name}}",
+ currentNotebook: "Current: {{name}}",
+ switchToNotebook: "Switch to {{name}}",
+ },
+ workspaceDialogs: {
+ emptyTrashTitle: "Empty trash",
+ emptyTrashDescription: "All notes in Trash and still-linked attachments will be deleted. This action cannot be undone.",
+ emptyTrashConfirm: "Empty trash",
+ deleteNotebookTitle: "Delete notebook “{{name}}”",
+ deleteNotebookDescription: "Clear its notes and child notebooks first. It cannot be restored from here after deletion.",
+ ok: "OK",
+ resizeMemoList: "Resize note list",
+ resizeMemoListHint: "Drag to resize the list column, double-click to reset, or use arrow keys for fine tuning",
+ },
+ evernoteGuide: {
+ title: "Evernote migration guide",
+ subtitle: "AI Agent powered migration that preserves notebook stack hierarchy",
+ },
+ evernoteImport: {
+ title: "Import Evernote",
+ guide: "Guide",
+ openGuideAria: "Open Evernote migration guide in a new tab",
+ description: "Review the steps for migrating from Evernote to EdgeEver. MCP and AI Agent batch import are recommended.",
+ },
+ session: {
+ loggingOut: "Signing out...",
+ logout: "Sign out",
+ },
+ mcp: {
+ createdTitle: "API Token created",
+ copyToken: "Copy token",
+ copyConfig: "Copy full MCP config",
+ securityWarning: "Security reminder: this token is a sensitive credential. Do not share it publicly.",
+ bearerPlaceholder: "Bearer my-created-token",
+ title: "Generate MCP config",
+ example: "Example",
+ exampleTitle: "Remote MCP example",
+ copyExample: "Copy example",
+ scopeTitle: "Token scopes",
+ selectedScopes: "{{selected}}/{{total}} selected",
+ loadingTokens: "Loading token list...",
+ emptyTokens: "No active API tokens",
+ noScope: "No scopes",
+ lastUsedAt: "Last used: {{time}}",
+ neverUsed: "Never used",
+ legacyTokenHint: "Plaintext cannot be recovered for old tokens. Generate a new one.",
+ legacyTokenCannotCopy: "Old token cannot be copied",
+ legacyConfigCannotCopy: "MCP config cannot be copied for old tokens",
+ deleteToken: "Delete token",
+ description: "Allow AI Agents to read and organize your notes.",
+ namePlaceholder: "Token purpose, e.g. MCP Agent",
+ createToken: "Generate token",
+ activeTokens: "Active tokens",
+ deleteConfirmTitle: "Delete token “{{name}}”?",
+ deleteConfirmDescription: "This cannot be undone. Once deleted, all clients using this token for API or MCP calls will immediately lose access.",
+ deleteConfirmLabel: "Delete token",
+ scopes: {
+ "read:notebooks": "Read notebooks",
+ "write:notebooks": "Create and edit notebooks",
+ "read:memos": "Read notes",
+ "write:memos": "Create and edit notes",
+ "read:resources": "Read attachment resources",
+ "write:resources": "Upload and edit attachments",
+ "read:tags": "Read tags",
+ "write:tags": "Create and edit tags",
+ },
+ },
+ advancedPlay: {
+ title: "Advanced plays",
+ description: "Advanced workflows with AI Agents.",
+ copyPrompt: "Copy prompt",
+ prompts: {
+ persona: {
+ title: "Persona profile",
+ prompt: "Use EdgeEver MCP to read my notes and create a persona profile based on the real note content. Judge only from evidence in the notes, do not make psychological diagnoses, and do not exaggerate traits. Include long-term themes, work preferences, capability signals, recurring problems, recent direction, and list related note titles or memo ids after each conclusion.",
+ },
+ knowledgeMap: {
+ title: "Knowledge map",
+ prompt: "Use EdgeEver MCP to read my notes and organize a knowledge map. Identify the main knowledge areas, key concepts in each area, related notes, what I already understand, and the gaps I still need to fill. Structure the output so it is useful for continued learning and writing.",
+ },
+ tagAdvice: {
+ title: "Tag suggestions",
+ prompt: "Use EdgeEver MCP to read my notes and existing tags, then design a clearer tag system. Point out duplicate, overly narrow, overly broad, or inconsistently named tags, and suggest merges, renames, and new tags. Do not modify notes yet. Wait for my confirmation before applying changes.",
+ },
+ },
+ },
+ templates: {
+ title: "Templates",
+ description: "Choose a template to create a note instantly.",
+ unavailable: "Select an available notebook before creating a note.",
+ items: {
+ quickNote: {
+ title: "Quick note",
+ description: "For temporary ideas, links, and sparks.",
+ contentMarkdown: "## Quick note\n\n- \n\n## Next actions\n\n- [ ] ",
+ },
+ meeting: {
+ title: "Meeting notes",
+ description: "Keep agenda, decisions, and todos on one page.",
+ contentMarkdown: "## Meeting notes\n\nTime:\nAttendees:\n\n## Agenda\n\n- \n\n## Decisions\n\n- \n\n## Todos\n\n- [ ] ",
+ },
+ checklist: {
+ title: "Checklist",
+ description: "Quickly list tasks, shopping items, or project checks.",
+ contentMarkdown: "## Checklist\n\n- [ ] \n- [ ] \n- [ ] ",
+ },
+ reading: {
+ title: "Reading notes",
+ description: "Collect excerpts, ideas, and follow-up reading.",
+ contentMarkdown: "## Reading notes\n\nBook:\nAuthor:\n\n## Excerpts\n\n> \n\n## My thoughts\n\n\n## Follow-up questions\n\n- ",
+ },
+ daily: {
+ title: "Daily review",
+ description: "Record what you finished today and where you got stuck.",
+ contentMarkdown: "## Daily review\n\n## Done today\n\n- \n\n## Blockers\n\n- \n\n## Tomorrow's priorities\n\n- [ ] ",
+ },
+ },
+ },
+ pwa: {
+ checkingTitle: "New version found",
+ checkingDescription: "Applying the update. The app will refresh shortly.",
+ appliedTitle: "EdgeEver updated",
+ appliedDescription: "You are running the latest version.",
+ readyTitle: "New version ready",
+ readyDescription: "Refresh to use the latest features.",
+ latestWithBuild: "You are running the latest version ({{buildLabel}}).",
+ refreshNow: "Refresh now",
+ closeNotice: "Close update notice",
+ },
+} as const;
diff --git a/apps/web/src/i18n/resources/zh-CN.ts b/apps/web/src/i18n/resources/zh-CN.ts
new file mode 100644
index 00000000..6ae63b45
--- /dev/null
+++ b/apps/web/src/i18n/resources/zh-CN.ts
@@ -0,0 +1,574 @@
+export const zhCN = {
+ common: {
+ appName: "EdgeEver",
+ close: "关闭",
+ cancel: "取消",
+ save: "保存",
+ delete: "删除",
+ loading: "正在加载",
+ back: "返回上一页",
+ language: "语言",
+ untitledMemo: "无标题笔记",
+ processing: "处理中",
+ saving: "保存中",
+ copied: "已复制",
+ githubRepository: "GitHub 仓库",
+ },
+ dialogs: {
+ memoDelete: {
+ permanentBulkTitle: "永久删除 {{count}} 条笔记",
+ permanentSingleTitle: "永久删除笔记",
+ softBulkTitle: "删除 {{count}} 条笔记",
+ softSingleTitle: "删除笔记",
+ permanentDescription: "这个操作不可恢复。",
+ softDescription: "删除后可以在回收站恢复。",
+ permanentConfirm: "永久删除",
+ softConfirm: "删除",
+ },
+ notebookName: {
+ createTitle: "新建笔记本",
+ renameTitle: "重命名笔记本",
+ createDescription: "创建一个新的笔记本,用来整理相关笔记。",
+ renameDescription: "更新后会立即同步到笔记本树。",
+ nameLabel: "名称",
+ namePlaceholder: "笔记本名称",
+ createSubmit: "创建",
+ },
+ },
+ login: {
+ title: "登录 EdgeEver",
+ subtitle: "自托管笔记工作区",
+ username: "账号",
+ password: "密码",
+ submitting: "安全登录中...",
+ submit: "开启工作区",
+ },
+ nav: {
+ mobileMain: "移动端主导航",
+ home: "首页",
+ mine: "我的",
+ createMemo: "新建笔记",
+ createDisabled: "当前视图不可新建笔记",
+ creating: "正在创建",
+ },
+ workspace: {
+ inboxDeleteTitle: "等待分类不能删除",
+ inboxDeleteDescription: "等待分类是默认笔记本,用来保证新笔记始终有归属。",
+ selection: {
+ pin: "置顶",
+ unpin: "取消置顶",
+ chooseMemo: "请选择笔记",
+ trashCannotPin: "回收站内不可置顶",
+ updatingPin: "正在更新置顶",
+ trashCannotMove: "回收站内不可移动",
+ noMovableNotebook: "没有可移动的笔记本",
+ moving: "正在移动",
+ move: "移动",
+ needTwoMemos: "至少选择 2 条笔记",
+ trashCannotMerge: "回收站内不可合并",
+ merging: "正在合并",
+ merge: "合并笔记",
+ deleting: "正在删除",
+ permanentDelete: "永久删除",
+ delete: "删除",
+ },
+ loading: {
+ notebooks: "正在加载笔记本",
+ settings: "正在加载个人中心",
+ assets: "正在加载资源库",
+ migration: "正在加载迁移指引",
+ editor: "正在加载编辑器",
+ },
+ pullToRefresh: {
+ refreshingNotes: "正在拉取最新笔记",
+ refreshingPage: "正在刷新网页",
+ releaseNotes: "松开刷新",
+ releasePage: "松开刷新网页",
+ pullNotes: "下拉刷新",
+ pullPage: "下拉刷新网页",
+ },
+ },
+ notebookPane: {
+ notebooks: "笔记本",
+ workspaceFallback: "边缘笔记工作区",
+ backToList: "返回笔记列表",
+ newNotebook: "新建笔记本",
+ newMemo: "新建笔记",
+ entries: "笔记入口",
+ allMemos: "全部笔记",
+ sortTitle: "笔记本排序:{{label}}",
+ loading: "加载中",
+ secondaryEntries: "辅助入口",
+ profile: "个人中心",
+ trash: "回收站",
+ emptyTrash: "清空回收站",
+ empty: "清空",
+ syncNow: "立即同步",
+ sync: {
+ offlineWithPending: "离线,{{count}} 项待同步",
+ offline: "离线",
+ syncing: "同步中",
+ conflicts: "{{count}} 项同步冲突",
+ retry: "{{count}} 项等待重试",
+ pending: "{{count}} 项待同步",
+ synced: "已同步",
+ },
+ },
+ notebookTree: {
+ dragNotebook: "移动笔记本「{{name}}」",
+ expandCollapse: "展开/折叠",
+ collapse: "收起 {{name}}",
+ expand: "展开 {{name}}",
+ current: "当前:{{name}}",
+ switchTo: "切换到 {{name}}",
+ newChild: "新建子笔记本",
+ newChildAria: "在 {{name}} 下新建子笔记本",
+ rename: "重命名",
+ renameNotebook: "重命名笔记本",
+ renameAria: "重命名 {{name}}",
+ deleteNotebook: "删除笔记本",
+ deleteAria: "删除 {{name}}",
+ },
+ settings: {
+ title: "我的",
+ subtitle: "个人偏好、MCP Token 与登录会话",
+ preferences: "偏好设置",
+ languageTitle: "界面语言",
+ languageDescription: "切换产品界面的显示语言。",
+ imageCompressionTitle: "压缩笔记内图片",
+ imageCompressionDescription: "上传大图时在本地压缩,节省资源占用。",
+ imageCompressionAria: "是否压缩笔记内图片",
+ },
+ shortcuts: {
+ title: "绑定快捷键",
+ manage: "管理",
+ description: "为常用笔记动作设置组合键。按 Esc 可取消当前录制。",
+ recording: "输入组合键",
+ reset: "恢复默认",
+ requireModifier: "请按下包含 Ctrl、⌘ 或 Alt 的组合键。",
+ conflict: "这个组合键已用于「{{label}}」。",
+ actions: {
+ createMemo: {
+ label: "新建笔记",
+ description: "在当前笔记本中创建一条新笔记。",
+ },
+ createNotebook: {
+ label: "新建笔记本",
+ description: "在当前层级创建一个新笔记本。",
+ },
+ focusSearch: {
+ label: "搜索笔记",
+ description: "打开搜索或聚焦笔记内搜索。",
+ },
+ focusReplace: {
+ label: "替换文本",
+ description: "在当前笔记中打开替换。",
+ },
+ },
+ },
+ options: {
+ memoDensity: {
+ preview: "预览列表",
+ compact: "紧凑列表",
+ },
+ memoSort: {
+ updatedDesc: "最近更新",
+ createdDesc: "创建时间",
+ titleAsc: "标题 A-Z",
+ },
+ notebookSort: {
+ nameAsc: "名称",
+ memoCountDesc: "笔记数量",
+ updatedDesc: "更新日期",
+ },
+ memoFilter: {
+ all: "全部",
+ pinned: "置顶",
+ tagged: "有标签",
+ untagged: "无标签",
+ },
+ },
+ mobileSheets: {
+ selectionCount: "已选择 {{count}} 条",
+ selectMemo: "选择笔记",
+ listOptions: "列表选项",
+ displayMode: "显示方式",
+ sortMode: "排序方式",
+ tags: "标签",
+ assets: "附件",
+ emptyTrash: "清空回收站",
+ trash: "回收站",
+ moveToNotebook: "移动到笔记本",
+ searchNotebook: "搜索笔记本",
+ noNotebookFound: "没有找到笔记本",
+ currentTarget: "当前目标:{{name}}",
+ moveTo: "移动到 {{name}}",
+ bulkActions: "批量操作",
+ mergeMemos: "合并笔记",
+ clearSelection: "取消选择",
+ more: "更多",
+ },
+ memoList: {
+ selectionCount: "已选择 {{count}} 条",
+ selectMemo: "选择笔记",
+ selectedListNone: "全不选当前列表",
+ selectedListAll: "全选当前列表",
+ noSelectableInList: "当前列表没有可选择的笔记",
+ chooseNotebook: "选择笔记本",
+ move: "移动",
+ mergeMemos: "合并笔记",
+ permanentDelete: "永久删除",
+ clearSelection: "取消选择",
+ cancelSearch: "退出搜索",
+ searchPlaceholder: "搜索笔记",
+ clearSearch: "清空搜索",
+ cancel: "取消",
+ switchNotebook: "切换笔记本",
+ bulkActions: "批量操作",
+ listOptions: "列表选项",
+ filterTitle: "筛选:{{label}}",
+ sortTitle: "排序:{{label}}",
+ previewList: "预览列表",
+ compactList: "紧凑列表",
+ emptyTrashTitle: "清空回收站,不可恢复",
+ emptyTrash: "清空",
+ more: "更多",
+ moreActions: "列表更多操作",
+ tags: "标签",
+ assets: "附件",
+ trash: "回收站",
+ currentNotebook: "当前笔记本",
+ allNotebooks: "所有笔记本",
+ deletedMemos: "已删除笔记",
+ allMemos: "全部笔记",
+ memoCount: "{{count}} 条笔记",
+ deletedCount: "{{count}} 条已删除",
+ constrainedCount: "{{label}} · {{count}} 条",
+ searchConstraint: "搜索「{{query}}」",
+ filterConstraint: "筛选:{{label}}",
+ reset: "重置",
+ fetchingLatest: "正在拉取最新笔记",
+ fetchEmptyTitle: "暂时没有拉到笔记",
+ fetchEmptyDescription: "网络或 PWA 后台恢复可能短暂中断了同步。这里不会把它当作空笔记本。",
+ retry: "重新拉取",
+ trashEmptyTitle: "回收站为空",
+ emptyTitle: "暂无笔记",
+ noFilteredTitle: "没有符合筛选的笔记",
+ trashEmptyDescription: "删除的笔记会显示在这里。",
+ emptyDescription: "先创建一条笔记,之后可以在这里快速预览、搜索和批量整理。",
+ noFilteredDescription: "试试切换筛选条件,或调整搜索关键词。",
+ newMemo: "新建笔记",
+ loadingMore: "正在加载更多笔记",
+ openMemo: "打开笔记",
+ unpin: "取消置顶",
+ pinMemo: "置顶笔记",
+ restoreMemo: "恢复笔记",
+ moveToNotebook: "移动到笔记本",
+ deleteMemo: "删除笔记",
+ toggleOffFilter: "取消{{label}}",
+ },
+ memoCard: {
+ yesterday: "昨天",
+ emptyMemo: "空笔记",
+ select: "选择 {{title}}",
+ unselect: "取消选择 {{title}}",
+ dragMany: "移动 {{count}} 条笔记",
+ dragOne: "移动「{{title}}」",
+ interactionHint: "Ctrl/Cmd 点击切换选择,Shift 点击连续选择,可拖到左侧笔记本移动,移动端长按进入选择",
+ moreActions: "更多操作",
+ restoreMemo: "恢复笔记",
+ deleteMemo: "删除笔记",
+ },
+ assets: {
+ uploadNth: "正在上传第 {{current}}/{{total}} 个文件...",
+ compressingFile: "正在压缩: {{filename}}",
+ uploadingFile: "正在上传: {{filename}}",
+ title: "附件管理",
+ fileCount: "{{count}} 文件",
+ imageCount: "{{count}} 图片",
+ filters: {
+ all: "全部",
+ image: "图片",
+ document: "文档",
+ other: "其他",
+ },
+ searchPlaceholder: "搜索附件名或来源笔记...",
+ gridView: "网格视图",
+ listView: "列表视图",
+ activeMemo: "当前关联笔记:《{{title}}》",
+ unnamedMemo: "未命名笔记",
+ unnamedShort: "未命名",
+ uploadAttachment: "上传附件",
+ processing: "处理中...",
+ noActiveMemoHint: "提示:在右侧编辑器中打开一篇笔记,即可在此处拖放或上传新文件。",
+ loading: "正在加载附件列表...",
+ noMatches: "未找到匹配附件",
+ empty: "暂无附件",
+ noMatchesDescription: "请尝试更改搜索词或分类过滤器",
+ emptyDescription: "拖拽文件到这里,或在上方上传文件",
+ previewImage: "大图预览",
+ downloadOpen: "下载/打开",
+ deletedMemo: "已删除笔记",
+ fromMemo: "来自:{{source}}",
+ sourceMemo: "来源笔记:{{source}}",
+ openInNewWindow: "在新窗口打开",
+ dropTitle: "将文件释放于此",
+ dropDescription: "文件将上传并附加到当前正在编辑的笔记:",
+ uploadSuccess: "上传成功!",
+ uploadError: "上传失败,请稍后重试",
+ },
+ tagsDialog: {
+ title: "标签",
+ count: "{{count}} tags",
+ loading: "加载中",
+ empty: "暂无标签",
+ nameLabel: "标签名称",
+ memoCount: "{{count}} 条笔记",
+ renameTitle: "重命名标签",
+ renameAria: "重命名标签 {{name}}",
+ deleteTitle: "删除标签",
+ deleteAria: "删除标签 {{name}}",
+ deleteConfirmTitle: "删除标签 #{{name}}",
+ deleteConfirmDescription: "将从 {{count}} 条笔记中移除这个标签,笔记内容不会被删除。",
+ deleteConfirmLabel: "删除标签",
+ },
+ revisions: {
+ emptyMemo: "空笔记",
+ title: "版本历史",
+ loading: "加载中",
+ empty: "暂无历史版本",
+ changedLines: "{{count}} changed lines",
+ noRevisionSelected: "No revision selected",
+ restoreVersion: "恢复该版本",
+ historyVersion: "历史版本",
+ currentContent: "当前内容",
+ restoreConfirmTitle: "恢复到这个历史版本",
+ restoreConfirmDescription: "当前内容会被这个历史版本替换,恢复后仍会产生新的历史记录。",
+ restoreConfirmLabel: "恢复",
+ },
+ editor: {
+ imageScale: "图片缩放",
+ scaleTo: "缩放到 {{percent}}%",
+ resizeImage: "拖拽调整图片宽度",
+ currentNotebook: "所在笔记本",
+ close: "关闭",
+ searchNotebook: "搜索笔记本",
+ noNotebookFound: "没有找到笔记本",
+ currentNotebookAria: "当前所在笔记本:{{name}}",
+ switchToNotebook: "切换到 {{name}}",
+ attachmentInsertText: "附件:{{filename}} {{url}}",
+ placeholder: "开始记录...",
+ loading: "加载中",
+ emptySelection: "选择或新建一条笔记",
+ saveState: {
+ saving: "保存中",
+ saved: "已保存",
+ queued: "待同步",
+ conflict: "有冲突",
+ error: "保存失败",
+ unsaved: "未保存",
+ },
+ uploadState: {
+ failed: "上传失败",
+ compressing: "压缩中",
+ uploading: "上传中",
+ fileFailed: "文件上传失败",
+ imageCompressing: "图片压缩中",
+ fileUploading: "文件上传中",
+ },
+ notebookFallback: "笔记本",
+ saveAndBack: "保存并返回列表",
+ backToList: "返回列表",
+ previousMemo: "上一条笔记",
+ nextMemo: "下一条笔记",
+ updatedAt: "更新于 {{time}}",
+ done: "完成",
+ uploadAttachment: "上传附件",
+ collapseFormat: "收起格式",
+ format: "格式",
+ searchCurrentMemo: "搜索当前笔记",
+ replaceCurrentMemo: "替换当前笔记",
+ versionHistory: "版本历史",
+ save: "保存",
+ more: "更多",
+ moreAria: "笔记更多操作",
+ restoreMemo: "恢复笔记",
+ deleteForever: "彻底删除",
+ deleteMemo: "删除笔记",
+ notebookPlaceholder: "所在笔记本",
+ tagPlaceholder: "添加标签,用逗号分隔",
+ searchPlaceholder: "在当前笔记内搜索",
+ replacePlaceholder: "替换为",
+ previousSearchResult: "上一个搜索结果",
+ nextSearchResult: "下一个搜索结果",
+ replaceAll: "全部替换",
+ closeSearch: "关闭搜索",
+ editMemo: "编辑笔记",
+ },
+ editorToolbar: {
+ toolbar: "编辑器工具栏",
+ paragraph: "正文",
+ heading1: "标题 1",
+ heading2: "标题 2",
+ heading3: "标题 3",
+ undo: "撤销",
+ redo: "重做",
+ bold: "加粗",
+ italic: "斜体",
+ strike: "删除线",
+ inlineCode: "行内代码",
+ bulletList: "无序列表",
+ orderedList: "有序列表",
+ quote: "引用",
+ codeBlock: "代码块",
+ horizontalRule: "分割线",
+ },
+ mobileNotebookPicker: {
+ title: "切换笔记本",
+ current: "当前:{{name}}",
+ allMemos: "全部笔记",
+ notebookFallback: "笔记本",
+ searchPlaceholder: "搜索笔记本",
+ clearSearch: "清空搜索",
+ currentAll: "当前:全部笔记",
+ switchAll: "切换到全部笔记",
+ matchedNotebooks: "匹配的笔记本",
+ notebooks: "笔记本",
+ collapseAllAria: "收起全部笔记本",
+ expandAllAria: "展开全部笔记本",
+ collapseAll: "收起全部",
+ expandAll: "展开全部",
+ noSearchResult: "没有找到「{{query}}」",
+ noNotebook: "没有找到笔记本",
+ showAll: "显示全部笔记本",
+ collapse: "收起 {{name}}",
+ expand: "展开 {{name}}",
+ currentNotebook: "当前:{{name}}",
+ switchToNotebook: "切换到 {{name}}",
+ },
+ workspaceDialogs: {
+ emptyTrashTitle: "清空回收站",
+ emptyTrashDescription: "回收站中的全部笔记和仍关联的附件都会删除,这个操作不可恢复。",
+ emptyTrashConfirm: "清空回收站",
+ deleteNotebookTitle: "删除笔记本「{{name}}」",
+ deleteNotebookDescription: "请先清空其中的笔记和子笔记本。删除后无法从这里恢复。",
+ ok: "知道了",
+ resizeMemoList: "调整笔记列表宽度",
+ resizeMemoListHint: "拖拽调整列表栏宽度,双击恢复默认,方向键微调",
+ },
+ evernoteGuide: {
+ title: "印象笔记迁移指引",
+ subtitle: "AI Agent 驱动一键迁移,无损保留笔记本组结构",
+ },
+ evernoteImport: {
+ title: "导入印象笔记",
+ guide: "操作指引",
+ openGuideAria: "在新标签页打开印象笔记迁移操作指引",
+ description: "查看从印象笔记迁移到 EdgeEver 的步骤,推荐使用 MCP 与 AI Agent 批量导入。",
+ },
+ session: {
+ loggingOut: "安全退出中...",
+ logout: "退出登录",
+ },
+ mcp: {
+ createdTitle: "API Token 已成功生成",
+ copyToken: "复制 Token",
+ copyConfig: "复制完整 MCP 配置",
+ securityWarning: "安全提醒:此 Token 属于高危凭证,请勿对外泄露。",
+ bearerPlaceholder: "Bearer 我创建的token",
+ title: "生成 MCP 配置",
+ example: "使用示例",
+ exampleTitle: "Remote MCP 示例",
+ copyExample: "复制示例",
+ scopeTitle: "Token 权限范围",
+ selectedScopes: "已选择 {{selected}}/{{total}}",
+ loadingTokens: "正在加载 Token 列表...",
+ emptyTokens: "暂无活跃的 API Token",
+ noScope: "无权限",
+ lastUsedAt: "上次调用时间:{{time}}",
+ neverUsed: "从未被调用",
+ legacyTokenHint: "旧 Token 无法找回明文,请重新生成",
+ legacyTokenCannotCopy: "旧 Token 无法复制",
+ legacyConfigCannotCopy: "旧 Token 无法复制 MCP 配置",
+ deleteToken: "删除 Token",
+ description: "让 AI Agent 可以读取和整理你的笔记。",
+ namePlaceholder: "Token 用途,例如:MCP Agent",
+ createToken: "生成 Token",
+ activeTokens: "活跃 Token",
+ deleteConfirmTitle: "确定要删除 Token「{{name}}」吗?",
+ deleteConfirmDescription: "删除操作不可逆。一旦删除,使用此 Token 进行 API 或 MCP 调用的一切客户端将立即失效并被拒绝访问。",
+ deleteConfirmLabel: "确认删除",
+ scopes: {
+ "read:notebooks": "读取笔记本",
+ "write:notebooks": "创建与修改笔记本",
+ "read:memos": "读取笔记",
+ "write:memos": "创建与修改笔记",
+ "read:resources": "读取附件资源",
+ "write:resources": "上传与修改附件",
+ "read:tags": "读取标签",
+ "write:tags": "创建与修改标签",
+ },
+ },
+ advancedPlay: {
+ title: "进阶玩法",
+ description: "搭配 AI Agent 的进阶玩法。",
+ copyPrompt: "复制 Prompt",
+ prompts: {
+ persona: {
+ title: "人物画像",
+ prompt: "请通过 EdgeEver MCP 读取我的笔记,基于真实笔记内容为我整理一份人物画像。请只根据笔记中的证据判断,不要做心理诊断,不要夸张定性。输出包括:长期关注的主题、做事偏好、能力线索、反复出现的问题、近期动向,并在每条结论后列出相关笔记标题或 memo id。",
+ },
+ knowledgeMap: {
+ title: "知识图谱",
+ prompt: "请通过 EdgeEver MCP 读取我的笔记,为我整理一份知识地图。请找出主要知识领域、每个领域下的关键概念、相关笔记、我已经掌握的部分和还需要补齐的问题。输出结构要适合后续继续学习和写作。",
+ },
+ tagAdvice: {
+ title: "标签建议",
+ prompt: "请通过 EdgeEver MCP 读取我的笔记和现有标签,帮我设计一套更清晰的标签体系。请指出重复、过细、过宽或命名不一致的标签,并给出合并、重命名和新增标签建议。先不要修改笔记,等我确认后再执行。",
+ },
+ },
+ },
+ templates: {
+ title: "模板",
+ description: "选择一个模板,直接创建新笔记。",
+ unavailable: "当前无法创建笔记,请先选择可用笔记本。",
+ items: {
+ quickNote: {
+ title: "速记",
+ description: "适合临时记录想法、链接和灵感。",
+ contentMarkdown: "## 速记\n\n- \n\n## 后续动作\n\n- [ ] ",
+ },
+ meeting: {
+ title: "会议记录",
+ description: "议题、结论和待办放在同一页。",
+ contentMarkdown: "## 会议记录\n\n时间:\n参与人:\n\n## 议题\n\n- \n\n## 结论\n\n- \n\n## 待办\n\n- [ ] ",
+ },
+ checklist: {
+ title: "清单",
+ description: "快速列出待办、采购、项目检查项。",
+ contentMarkdown: "## 清单\n\n- [ ] \n- [ ] \n- [ ] ",
+ },
+ reading: {
+ title: "读书笔记",
+ description: "摘录、观点和下一步阅读整理。",
+ contentMarkdown: "## 读书笔记\n\n书名:\n作者:\n\n## 摘录\n\n> \n\n## 我的观点\n\n\n## 延伸问题\n\n- ",
+ },
+ daily: {
+ title: "每日复盘",
+ description: "记录今天完成了什么、卡在哪里。",
+ contentMarkdown: "## 每日复盘\n\n## 今天完成\n\n- \n\n## 遇到的问题\n\n- \n\n## 明天优先级\n\n- [ ] ",
+ },
+ },
+ },
+ pwa: {
+ checkingTitle: "发现新版本",
+ checkingDescription: "正在应用更新,稍后会自动刷新。",
+ appliedTitle: "EdgeEver 已更新",
+ appliedDescription: "当前应用已是最新版本。",
+ readyTitle: "新版本已就绪",
+ readyDescription: "刷新后即可使用最新功能。",
+ latestWithBuild: "当前应用已是最新版本({{buildLabel}})。",
+ refreshNow: "立即刷新",
+ closeNotice: "关闭更新通知",
+ },
+} as const;
diff --git a/apps/web/src/lib/app-helpers.ts b/apps/web/src/lib/app-helpers.ts
index abb68432..5115b4c4 100644
--- a/apps/web/src/lib/app-helpers.ts
+++ b/apps/web/src/lib/app-helpers.ts
@@ -3,6 +3,7 @@ import { DEFAULT_MEMO_TITLE } from "@edgeever/shared";
import { buildNotebookTree, type NotebookNode, type NotebookNodeComparator } from "./utils";
import * as React from "react";
import type { ReactNode } from "react";
+import type { TFunction } from "i18next";
export type Pane = "notebooks" | "memos" | "editor";
export type MemoView = "notebook" | "trash";
@@ -38,40 +39,40 @@ export type MemoTemplate = {
tags: string[];
};
-export const MEMO_TEMPLATES: MemoTemplate[] = [
+export const getMemoTemplates = (t: TFunction): MemoTemplate[] => [
{
id: "quick-note",
- title: "速记",
- description: "适合临时记录想法、链接和灵感。",
- contentMarkdown: "## 速记\n\n- \n\n## 后续动作\n\n- [ ] ",
+ title: t("templates.items.quickNote.title"),
+ description: t("templates.items.quickNote.description"),
+ contentMarkdown: t("templates.items.quickNote.contentMarkdown"),
tags: ["template", "quick-note"],
},
{
id: "meeting",
- title: "会议记录",
- description: "议题、结论和待办放在同一页。",
- contentMarkdown: "## 会议记录\n\n时间:\n参与人:\n\n## 议题\n\n- \n\n## 结论\n\n- \n\n## 待办\n\n- [ ] ",
+ title: t("templates.items.meeting.title"),
+ description: t("templates.items.meeting.description"),
+ contentMarkdown: t("templates.items.meeting.contentMarkdown"),
tags: ["template", "meeting"],
},
{
id: "checklist",
- title: "清单",
- description: "快速列出待办、采购、项目检查项。",
- contentMarkdown: "## 清单\n\n- [ ] \n- [ ] \n- [ ] ",
+ title: t("templates.items.checklist.title"),
+ description: t("templates.items.checklist.description"),
+ contentMarkdown: t("templates.items.checklist.contentMarkdown"),
tags: ["template", "checklist"],
},
{
id: "reading",
- title: "读书笔记",
- description: "摘录、观点和下一步阅读整理。",
- contentMarkdown: "## 读书笔记\n\n书名:\n作者:\n\n## 摘录\n\n> \n\n## 我的观点\n\n\n## 延伸问题\n\n- ",
+ title: t("templates.items.reading.title"),
+ description: t("templates.items.reading.description"),
+ contentMarkdown: t("templates.items.reading.contentMarkdown"),
tags: ["template", "reading"],
},
{
id: "daily",
- title: "每日复盘",
- description: "记录今天完成了什么、卡在哪里。",
- contentMarkdown: "## 每日复盘\n\n## 今天完成\n\n- \n\n## 遇到的问题\n\n- \n\n## 明天优先级\n\n- [ ] ",
+ title: t("templates.items.daily.title"),
+ description: t("templates.items.daily.description"),
+ contentMarkdown: t("templates.items.daily.contentMarkdown"),
tags: ["template", "daily"],
},
];
@@ -160,30 +161,50 @@ export const MAX_MEMO_LIST_WIDTH_PX = 540;
export const MEMO_DRAG_MIME = "application/x-edgeever-memos";
export const NOTEBOOK_DRAG_MIME = "application/x-edgeever-notebook";
-export const MEMO_SORT_OPTIONS: Array<{ value: MemoSortMode; label: string }> = [
- { value: "updated-desc", label: "最近更新" },
- { value: "created-desc", label: "创建时间" },
- { value: "title-asc", label: "标题 A-Z" },
+export const getMemoSortOptions = (t: TFunction): Array<{ value: MemoSortMode; label: string }> => [
+ { value: "updated-desc", label: t("options.memoSort.updatedDesc") },
+ { value: "created-desc", label: t("options.memoSort.createdDesc") },
+ { value: "title-asc", label: t("options.memoSort.titleAsc") },
];
-export const NOTEBOOK_SORT_OPTIONS: Array<{ value: NotebookSortMode; label: string }> = [
- { value: "name-asc", label: "名称" },
- { value: "memo-count-desc", label: "笔记数量" },
- { value: "updated-desc", label: "更新日期" },
+const NOTEBOOK_SORT_VALUES: NotebookSortMode[] = ["name-asc", "memo-count-desc", "updated-desc"];
+
+export const getNotebookSortOptions = (t: TFunction): Array<{ value: NotebookSortMode; label: string }> => [
+ { value: "name-asc", label: t("options.notebookSort.nameAsc") },
+ { value: "memo-count-desc", label: t("options.notebookSort.memoCountDesc") },
+ { value: "updated-desc", label: t("options.notebookSort.updatedDesc") },
];
-export const MEMO_FILTER_OPTIONS: Array<{ value: MemoFilterMode; label: string }> = [
- { value: "all", label: "全部" },
- { value: "pinned", label: "置顶" },
- { value: "tagged", label: "有标签" },
- { value: "untagged", label: "无标签" },
+export const getMemoFilterOptions = (t: TFunction): Array<{ value: MemoFilterMode; label: string }> => [
+ { value: "all", label: t("options.memoFilter.all") },
+ { value: "pinned", label: t("options.memoFilter.pinned") },
+ { value: "tagged", label: t("options.memoFilter.tagged") },
+ { value: "untagged", label: t("options.memoFilter.untagged") },
];
-export const SHORTCUT_ACTION_OPTIONS: Array<{ value: ShortcutAction; label: string; description: string }> = [
- { value: "createMemo", label: "新建笔记", description: "在当前笔记本中创建一条新笔记。" },
- { value: "createNotebook", label: "新建笔记本", description: "在当前层级创建一个新笔记本。" },
- { value: "focusSearch", label: "搜索笔记", description: "打开搜索或聚焦笔记内搜索。" },
- { value: "focusReplace", label: "替换文本", description: "在当前笔记中打开替换。" },
+export const getShortcutActionOptions = (
+ t: TFunction
+): Array<{ value: ShortcutAction; label: string; description: string }> => [
+ {
+ value: "createMemo",
+ label: t("shortcuts.actions.createMemo.label"),
+ description: t("shortcuts.actions.createMemo.description"),
+ },
+ {
+ value: "createNotebook",
+ label: t("shortcuts.actions.createNotebook.label"),
+ description: t("shortcuts.actions.createNotebook.description"),
+ },
+ {
+ value: "focusSearch",
+ label: t("shortcuts.actions.focusSearch.label"),
+ description: t("shortcuts.actions.focusSearch.description"),
+ },
+ {
+ value: "focusReplace",
+ label: t("shortcuts.actions.focusReplace.label"),
+ description: t("shortcuts.actions.focusReplace.description"),
+ },
];
export const DEFAULT_SHORTCUT_SETTINGS: ShortcutSettings = {
@@ -193,7 +214,7 @@ export const DEFAULT_SHORTCUT_SETTINGS: ShortcutSettings = {
focusReplace: { key: "h", ctrlOrMeta: true, shift: false, alt: false },
};
-const SHORTCUT_ACTION_VALUES = SHORTCUT_ACTION_OPTIONS.map((option) => option.value);
+const SHORTCUT_ACTION_VALUES: ShortcutAction[] = ["createMemo", "createNotebook", "focusSearch", "focusReplace"];
export const getMemoTitle = (title: string | null | undefined) => title?.trim() || DEFAULT_MEMO_TITLE;
@@ -274,7 +295,7 @@ export const writeMemoListWidthPreference = (width: number) => {
export const readNotebookSortPreference = (): NotebookSortMode => {
try {
const sortMode = window.localStorage.getItem(NOTEBOOK_SORT_STORAGE_KEY);
- return NOTEBOOK_SORT_OPTIONS.some((option) => option.value === sortMode) ? (sortMode as NotebookSortMode) : "name-asc";
+ return NOTEBOOK_SORT_VALUES.includes(sortMode as NotebookSortMode) ? (sortMode as NotebookSortMode) : "name-asc";
} catch {
return "name-asc";
}
diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx
index 5a8fca24..c7b95436 100644
--- a/apps/web/src/main.tsx
+++ b/apps/web/src/main.tsx
@@ -4,6 +4,7 @@ import { createRoot } from "react-dom/client";
import { BrowserRouter } from "react-router";
import { registerSW } from "virtual:pwa-register";
import { App } from "./app/App";
+import "./i18n";
import { emitPwaUpdateNotice, markPwaUpdateReloadPending } from "./lib/pwa-update-notice";
import "./styles/globals.css";
diff --git a/bun.lock b/bun.lock
index 74f49c4e..0354d836 100644
--- a/bun.lock
+++ b/bun.lock
@@ -27,11 +27,13 @@
"dexie": "latest",
"fast-xml-parser": "^5.9.3",
"hono": "latest",
+ "i18next": "^26.3.4",
"lucide-react": "latest",
"marked": "^18.0.5",
"react": "latest",
"react-dom": "latest",
"react-dropzone": "^15.0.0",
+ "react-i18next": "^17.0.8",
"react-router": "^8.1.0",
"sharp": "^0.35.2",
"tailwind-merge": "latest",
@@ -1323,12 +1325,16 @@
"html-escaper": ["[email protected]", "", {}, "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="],
+ "html-parse-stringify": ["[email protected]", "", { "dependencies": { "void-elements": "3.1.0" } }, "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg=="],
+
"html-void-elements": ["[email protected]", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="],
"htmlparser2": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.2.2", "entities": "^7.0.1" } }, "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ=="],
"http-cache-semantics": ["[email protected]", "", {}, "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ=="],
+ "i18next": ["[email protected]", "", { "peerDependencies": { "typescript": "^5 || ^6" }, "optionalPeers": ["typescript"] }, "sha512-pa7m0d7pBDqGHZxljT+WPFeyFgQ7P7SciPPo1tTqYuO0z4sqADYhwnBESmmGp/wEof1inwdls/k8ZgTg8rxFHA=="],
+
"iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
"idb": ["[email protected]", "", {}, "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ=="],
@@ -1803,6 +1809,8 @@
"react-dropzone": ["[email protected]", "", { "dependencies": { "attr-accept": "^2.2.4", "file-selector": "^2.1.0", "prop-types": "^15.8.1" }, "peerDependencies": { "react": ">= 16.8 || 18.0.0" } }, "sha512-lGjYV/EoqEjEWPnmiSvH4v5IoIAwQM2W4Z1C0Q/Pw2xD0eVzKPS359BQTUMum+1fa0kH2nrKjuavmTPOGhpLPg=="],
+ "react-i18next": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.29.2", "html-parse-stringify": "^3.0.1", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "i18next": ">= 26.2.0", "react": ">= 16.8.0", "react-dom": "*", "react-native": "*", "typescript": "^5 || ^6" }, "optionalPeers": ["react-dom", "react-native", "typescript"] }, "sha512-0ooKbGLU8JXhe1zwpQUWIeXSgLPOfwJmgheWRIUpcoA0CpyabpGhayjdG+/eA5esC1AQ8h2jWpXjJfzQzeDOCw=="],
+
"react-is": ["[email protected]", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="],
"react-refresh": ["[email protected]", "", {}, "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw=="],
@@ -2131,6 +2139,8 @@
"vitefu": ["[email protected]", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg=="],
+ "void-elements": ["[email protected]", "", {}, "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w=="],
+
"volar-service-css": ["[email protected]", "", { "dependencies": { "vscode-css-languageservice": "^6.3.0", "vscode-languageserver-textdocument": "^1.0.11", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-wRRFt9BpjMKCazcgOh67MSjUjiWUCAh99DyYSDIOTuxaRjEtDC7PpB0k1Y1wbJIW/pVtMUSVbpPo3UGSm0Byxw=="],
"volar-service-emmet": ["[email protected]", "", { "dependencies": { "@emmetio/css-parser": "^0.4.1", "@emmetio/html-matcher": "^1.3.0", "@vscode/emmet-helper": "^2.9.3", "vscode-uri": "^3.0.8" }, "peerDependencies": { "@volar/language-service": "~2.4.0" }, "optionalPeers": ["@volar/language-service"] }, "sha512-zqjzt6bN95e3CUstBm0PBFAJnrfz0ZAARka87fart46/gNCLLuP3Vujy8V/J8HEziTFLnfkgIASLFYPUhonJcA=="],
diff --git a/docs/evernote-migration-guide.en-US.md b/docs/evernote-migration-guide.en-US.md
new file mode 100644
index 00000000..fe480e74
--- /dev/null
+++ b/docs/evernote-migration-guide.en-US.md
@@ -0,0 +1,48 @@
+# Minimal Evernote Migration Guide
+
+[简体中文](evernote-migration-guide.md) | [English](evernote-migration-guide.en-US.md)
+
+We strongly recommend using an AI coding assistant, such as Antigravity, Claude Code, or Cursor, to run the migration automatically. The current migration flow is optimized for streaming large archives and preprocessing empty text, and can handle multi-GB note libraries while preserving created/updated timestamps and nested notebook hierarchy.
+
+---
+
+### Step 1: Configure and install the EdgeEver MCP service
+
+1. Open EdgeEver and click **Profile / Settings** in the lower-left corner.
+2. In the **API & MCP authorization** card, generate a token and click **Copy full MCP config**.
+3. Paste the copied JSON into your AI coding assistant and ask it to install the MCP service in your current AI client:
+
+```sh
+You are an AI coding assistant. This is my EdgeEver MCP service configuration JSON. Please configure this MCP service directly in the MCP server configuration file for my current AI editor/client, such as Claude Code, Cursor, or Cline:
+
+<paste the copied JSON configuration here>
+```
+
+---
+
+### Step 2: Let the AI assistant import and migrate your notes
+
+After the assistant has configured MCP, send it this prompt:
+
+```sh
+You are an AI coding assistant. Please migrate my local Evernote data into my deployed EdgeEver instance:
+1. Check for and install the backup tool with `pipx install evernote-backup`.
+2. Ask me for my Evernote username and password, initialize the database with the China backend if needed, sync the data, and export it to `./evernote-export`.
+3. Download the latest migration script from GitHub: `https://raw.githubusercontent.com/msh01/edgeever/main/scripts/import-evernote-enex-via-mcp.mjs`.
+4. Install the local dependencies required by the script: `sharp` and `fast-xml-parser`.
+5. Run the script with the previously configured URL and token to complete the migration. The script performs WebP image conversion automatically:
+ - Full migration: `bun import-evernote-enex-via-mcp.mjs --input "./evernote-export" --yes`
+ - Selected notebooks only: add `--include "NotebookA,NotebookB"`.
+
+Tell me what information you need, such as account credentials, then run the steps automatically and in parallel where possible.
+```
+
+> Manual fallback: If you do not use an AI assistant, download `scripts/import-evernote-enex-via-mcp.mjs` from the [EdgeEver GitHub repository](https://github.com/msh01/edgeever) and follow the comments at the top of the script.
+
+---
+
+### Step 3: Verify the result in the Web app
+
+1. After import completes, refresh the EdgeEver Web app.
+2. Check the left sidebar and confirm the original Evernote notebook stack hierarchy is restored.
+3. Open several notes with images and verify that images load and display clearly in the editor.
diff --git a/docs/evernote-migration-guide.md b/docs/evernote-migration-guide.md
index a8d3edb7..e37ce051 100644
--- a/docs/evernote-migration-guide.md
+++ b/docs/evernote-migration-guide.md
@@ -1,5 +1,7 @@
# 印象笔记(Evernote)极简迁移指引
+[简体中文](evernote-migration-guide.md) | [English](evernote-migration-guide.en-US.md)
+
我们强烈推荐使用 AI 编程助手(如 Antigravity、Claude Code、Cursor 等)自动执行迁移。该方案已完成内存流式优化与空文本预处理,能安全应对数 GB 级别超大笔记库,完整保留创建/修改时间与嵌套笔记本目录层级。
---
diff --git a/package.json b/package.json
index 3b3807bb..413f3051 100644
--- a/package.json
+++ b/package.json
@@ -64,11 +64,13 @@
"dexie": "latest",
"fast-xml-parser": "^5.9.3",
"hono": "latest",
+ "i18next": "^26.3.4",
"lucide-react": "latest",
"marked": "^18.0.5",
"react": "latest",
"react-dom": "latest",
"react-dropzone": "^15.0.0",
+ "react-i18next": "^17.0.8",
"react-router": "^8.1.0",
"sharp": "^0.35.2",
"tailwind-merge": "latest",