дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
On Windows and Linux several places still named macOS's Finder: the recent-project row menu (Show in Finder), Settings › Version Control › Confirmation › When patch is created, the question after a patch is saved, and the reveal error. The wording was an English literal at each call site, one place sniffed the user agent, and the catalogs only had Finder's text. Shared helpers in src/platform/fileManager.ts now name Finder / Explorer / Files from the platform info, and the project view's Reveal action, the editor tab menu, the project tree menu, the welcome page and the patch flow use them, with whole-sentence catalog entries so each locale can translate them. Co-authored-by: emanyzwww <[email protected]>
23 рядки
1023 B
TypeScript
23 рядки
1023 B
TypeScript
import { afterEach, expect, it } from "vitest";
|
|
import { _resetI18nForTests, setLocale, tx } from "@/platform/i18n";
|
|
import { usePlatform } from "@/platform/platformInfo";
|
|
import { patchSavedBody } from "../patches";
|
|
|
|
afterEach(() => _resetI18nForTests());
|
|
|
|
it.each([
|
|
["macos", "Patch file created successfully. Show it in Finder?", "补丁文件已创建。是否在访达中显示?"],
|
|
["windows", "Patch file created successfully. Show it in Explorer?", "补丁文件已创建。是否在资源管理器中显示?"],
|
|
["linux", "Patch file created successfully. Show it in Files?", "补丁文件已创建。是否在文件管理器中显示?"],
|
|
])("asks to show the saved patch in the %s file manager", async (os, english, chinese) => {
|
|
const previous = usePlatform.getState().os;
|
|
try {
|
|
usePlatform.setState({ os });
|
|
expect(patchSavedBody()).toBe(english);
|
|
await setLocale("zh");
|
|
expect(tx(patchSavedBody())).toBe(chinese);
|
|
} finally {
|
|
usePlatform.setState({ os: previous });
|
|
}
|
|
});
|