AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
i18n(mobile): translate buttons, statuses and errors shown in Chinese (#485)
Dariusz Koryto8c3745c004c7
diff --git a/apps/ios/EdgeEver/App/RootView.swift b/apps/ios/EdgeEver/App/RootView.swiftindex 48a4431a..17340cc8 100644--- a/apps/ios/EdgeEver/App/RootView.swift+++ b/apps/ios/EdgeEver/App/RootView.swift@@ -6,7 +6,7 @@ struct RootView: View {var body: some View {Group {if env.session.isLoading {- ProgressView("启动中…")+ ProgressView(env.preferences.t("启动中…", en: "Starting…", ja: "起動しています…", pl: "Uruchamianie…"))} else if env.session.isSignedIn {WorkspaceView()} else {diff --git a/apps/mobile/src/lib/mobile-locale.test.mjs b/apps/mobile/src/lib/mobile-locale.test.mjsindex 814e1ffd..70b6f9d4 100644--- a/apps/mobile/src/lib/mobile-locale.test.mjs+++ b/apps/mobile/src/lib/mobile-locale.test.mjs@@ -15,6 +15,29 @@ describe("mobile locale translation", () => {expect(translateMobileText("从相册选择", "pl")).toBe("Wybierz z galerii");});+ test("translates the buttons, statuses and errors that were shown in Chinese for every locale", () => {+ // These literals reach users through LocalizedText, Alert and Pressable,+ // which only translate copy that has a dictionary entry.+ const copy = [+ "确定", "好的", "登录", "删除失败", "删除中", "恢复中", "恢复失败", "创建失败", "请重试",+ "请检查网络后重试", "当前无法连接实例,请稍后重试", "换个关键词再试", "没有找到匹配笔记", "重试加载",+ "请先创建一个笔记本", "附件上传失败", "保存中", "准备中", "本地草稿", "未保存",+ "缺少笔记数据,无法打开富文本编辑器", "笔记加载失败", "进入编辑并聚焦标题", "编辑笔记标题",+ "更改笔记所属笔记本", "选择历史记录后可预览并恢复。", "当前无法读取附件。", "当前无法读取资源。",+ "请等待笔记同步完成。", "资源读取失败", "已取消下载", "当前设备无法打开系统分享面板",+ "登录成功但服务端没有返回移动端会话。请确认服务端已更新到支持 App 登录的版本。",+ ];+ // Japanese writes "unsaved" with the same characters as Chinese.+ const sameInJapanese = new Set(["未保存"]);+ for (const locale of ["en-US", "ja", "pl"]) {+ const untranslated = copy.filter((value) => translateMobileText(value, locale) === value+ && !(locale === "ja" && sameInJapanese.has(value)));+ expect({ locale, untranslated }).toEqual({ locale, untranslated: [] });+ }+ expect(translateMobileText("登录", "pl")).toBe("Zaloguj się");+ expect(translateMobileText("确定", "zh-CN")).toBe("确定");+ });+test("prefers specific mobile-only templates over broader templates", () => {expect(translateMobileText("已加载 12 / 40 条笔记", "en-US")).toBe("Loaded 12 of 40 notes");expect(translateMobileText("筛选:Pinned · 3 条", "en-US")).toBe("Filter: Pinned · 3 notes");diff --git a/apps/mobile/src/lib/mobile-locale.tsx b/apps/mobile/src/lib/mobile-locale.tsxindex f7edaed6..31cc3f65 100644--- a/apps/mobile/src/lib/mobile-locale.tsx+++ b/apps/mobile/src/lib/mobile-locale.tsx@@ -19,6 +19,39 @@ type MobileLocaleContextValue = {type TranslationPair = { source: string; target: string; pattern?: RegExp; placeholders?: string[] };const mobileOnlyTranslations = new Map<string, string>([+ ["确定", "OK"],+ ["好的", "OK"],+ ["登录", "Sign in"],+ ["删除失败", "Could not delete"],+ ["删除中", "Deleting"],+ ["恢复中", "Restoring"],+ ["恢复失败", "Could not restore"],+ ["创建失败", "Could not create"],+ ["请重试", "Please try again"],+ ["请检查网络后重试", "Check your network and try again"],+ ["当前无法连接实例,请稍后重试", "Cannot reach the instance right now. Try again later."],+ ["换个关键词再试", "Try a different keyword"],+ ["没有找到匹配笔记", "No matching notes"],+ ["重试加载", "Retry loading"],+ ["请先创建一个笔记本", "Create a notebook first"],+ ["附件上传失败", "Could not upload the attachment"],+ ["保存中", "Saving"],+ ["准备中", "Preparing"],+ ["本地草稿", "Local draft"],+ ["未保存", "Not saved"],+ ["缺少笔记数据,无法打开富文本编辑器", "The note data is missing, so the rich text editor cannot open."],+ ["笔记加载失败", "Could not load the note"],+ ["进入编辑并聚焦标题", "Starts editing and moves focus to the title"],+ ["编辑笔记标题", "Edit note title"],+ ["更改笔记所属笔记本", "Change the note's notebook"],+ ["选择历史记录后可预览并恢复。", "Select a version to preview and restore it."],+ ["当前无法读取附件。", "The attachment cannot be read right now."],+ ["当前无法读取资源。", "The resource cannot be read right now."],+ ["请等待笔记同步完成。", "Wait for the note to finish syncing."],+ ["资源读取失败", "Could not read the resource"],+ ["已取消下载", "Download canceled"],+ ["当前设备无法打开系统分享面板", "This device cannot open the system share sheet"],+ ["登录成功但服务端没有返回移动端会话。请确认服务端已更新到支持 App 登录的版本。", "Signed in, but the server did not return a mobile session. Make sure the server is updated to a version that supports app sign-in."],["新建笔记本", "New notebook"],["创建笔记本", "Create notebook"],["笔记本名称", "Notebook name"],@@ -219,6 +252,39 @@ const mobileOnlyTranslations = new Map<string, string>([]);const mobileOnlyJapanese = new Map<string, string>([+ ["确定", "OK"],+ ["好的", "OK"],+ ["登录", "ログイン"],+ ["删除失败", "削除できませんでした"],+ ["删除中", "削除しています"],+ ["恢复中", "復元しています"],+ ["恢复失败", "復元できませんでした"],+ ["创建失败", "作成できませんでした"],+ ["请重试", "再試行してください"],+ ["请检查网络后重试", "ネットワークを確認して再試行してください"],+ ["当前无法连接实例,请稍后重试", "現在インスタンスに接続できません。しばらくしてから再試行してください。"],+ ["换个关键词再试", "別のキーワードで試してください"],+ ["没有找到匹配笔记", "一致するノートはありません"],+ ["重试加载", "再読み込み"],+ ["请先创建一个笔记本", "先にノートブックを作成してください"],+ ["附件上传失败", "添付をアップロードできませんでした"],+ ["保存中", "保存しています"],+ ["准备中", "準備しています"],+ ["本地草稿", "ローカル下書き"],+ ["未保存", "未保存"],+ ["缺少笔记数据,无法打开富文本编辑器", "ノートのデータがないため、リッチテキストエディタを開けません。"],+ ["笔记加载失败", "ノートを読み込めませんでした"],+ ["进入编辑并聚焦标题", "編集を開始してタイトルにフォーカスします"],+ ["编辑笔记标题", "ノートのタイトルを編集"],+ ["更改笔记所属笔记本", "ノートのノートブックを変更"],+ ["选择历史记录后可预览并恢复。", "履歴を選ぶとプレビューして復元できます。"],+ ["当前无法读取附件。", "現在添付を読み込めません。"],+ ["当前无法读取资源。", "現在リソースを読み込めません。"],+ ["请等待笔记同步完成。", "ノートの同期が終わるまでお待ちください。"],+ ["资源读取失败", "リソースを読み込めませんでした"],+ ["已取消下载", "ダウンロードをキャンセルしました"],+ ["当前设备无法打开系统分享面板", "この端末ではシステムの共有シートを開けません"],+ ["登录成功但服务端没有返回移动端会话。请确认服务端已更新到支持 App 登录的版本。", "サインインしましたが、サーバーがモバイルセッションを返しませんでした。サーバーがアプリのサインインに対応したバージョンに更新されているか確認してください。"],["新建笔记本", "新しいノートブック"],["创建笔记本", "ノートブックを作成"],["笔记本名称", "ノートブック名"],@@ -418,6 +484,39 @@ const mobileOnlyJapanese = new Map<string, string>([]);const mobileOnlyPolish = new Map<string, string>([+ ["确定", "OK"],+ ["好的", "OK"],+ ["登录", "Zaloguj się"],+ ["删除失败", "Nie udało się usunąć"],+ ["删除中", "Usuwanie"],+ ["恢复中", "Przywracanie"],+ ["恢复失败", "Nie udało się przywrócić"],+ ["创建失败", "Nie udało się utworzyć"],+ ["请重试", "Spróbuj ponownie"],+ ["请检查网络后重试", "Sprawdź sieć i spróbuj ponownie"],+ ["当前无法连接实例,请稍后重试", "Nie można teraz połączyć się z instancją. Spróbuj ponownie później."],+ ["换个关键词再试", "Spróbuj innego słowa kluczowego"],+ ["没有找到匹配笔记", "Brak pasujących notatek"],+ ["重试加载", "Wczytaj ponownie"],+ ["请先创建一个笔记本", "Najpierw utwórz notatnik"],+ ["附件上传失败", "Nie udało się przesłać załącznika"],+ ["保存中", "Zapisywanie"],+ ["准备中", "Przygotowywanie"],+ ["本地草稿", "Wersja robocza na urządzeniu"],+ ["未保存", "Nie zapisano"],+ ["缺少笔记数据,无法打开富文本编辑器", "Brak danych notatki, więc nie można otworzyć edytora tekstu sformatowanego."],+ ["笔记加载失败", "Nie udało się wczytać notatki"],+ ["进入编辑并聚焦标题", "Rozpoczyna edycję i przenosi fokus na tytuł"],+ ["编辑笔记标题", "Edytuj tytuł notatki"],+ ["更改笔记所属笔记本", "Zmień notatnik tej notatki"],+ ["选择历史记录后可预览并恢复。", "Wybierz wersję, aby ją podejrzeć i przywrócić."],+ ["当前无法读取附件。", "Nie można teraz odczytać załącznika."],+ ["当前无法读取资源。", "Nie można teraz odczytać zasobu."],+ ["请等待笔记同步完成。", "Poczekaj na zakończenie synchronizacji notatki."],+ ["资源读取失败", "Nie udało się odczytać zasobu"],+ ["已取消下载", "Pobieranie anulowane"],+ ["当前设备无法打开系统分享面板", "Na tym urządzeniu nie można otworzyć systemowego okna udostępniania"],+ ["登录成功但服务端没有返回移动端会话。请确认服务端已更新到支持 App 登录的版本。", "Zalogowano, ale serwer nie zwrócił sesji mobilnej. Upewnij się, że serwer jest zaktualizowany do wersji obsługującej logowanie w aplikacji."],["新建笔记本", "Nowy notatnik"],["创建笔记本", "Utwórz notatnik"],["笔记本名称", "Nazwa notatnika"],