Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,57 +117,57 @@ function setupApplicationMenu() {

template.push(
{
label: "File",
label: "文件",
submenu: [
{
label: "Load Project…",
label: "加载项目…",
accelerator: "CmdOrCtrl+O",
click: () => sendEditorMenuAction("menu-load-project"),
},
{
label: "Save Project…",
label: "保存项目…",
Comment on lines +120 to +128
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are all off this is in Chinese? Shouldn't you be localizing them?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this is probably not the best way to do it, as you'd want to add more languages. That convolutes the main.ts file.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only should be seeing them in the locale file of the language you are trying to add.

accelerator: "CmdOrCtrl+S",
click: () => sendEditorMenuAction("menu-save-project"),
},
{
label: "Save Project As…",
label: "另存项目…",
accelerator: "CmdOrCtrl+Shift+S",
click: () => sendEditorMenuAction("menu-save-project-as"),
},
...(isMac ? [] : [{ type: "separator" as const }, { role: "quit" as const }]),
...(isMac ? [] : [{ type: "separator" as const }, { role: "quit" as const, label: "退出" }]),
],
},
{
label: "Edit",
label: "编辑",
submenu: [
{ role: "undo" },
{ role: "redo" },
{ role: "undo", label: "撤销" },
{ role: "redo", label: "重做" },
{ type: "separator" },
{ role: "cut" },
{ role: "copy" },
{ role: "paste" },
{ role: "selectAll" },
{ role: "cut", label: "剪切" },
{ role: "copy", label: "复制" },
{ role: "paste", label: "粘贴" },
{ role: "selectAll", label: "全选" },
],
},
{
label: "View",
label: "视图",
submenu: [
{ role: "reload" },
{ role: "forceReload" },
{ role: "toggleDevTools" },
{ role: "reload", label: "重新加载" },
{ role: "forceReload", label: "强制重新加载" },
{ role: "toggleDevTools", label: "开发者工具" },
{ type: "separator" },
{ role: "resetZoom" },
{ role: "zoomIn" },
{ role: "zoomOut" },
{ role: "resetZoom", label: "重置缩放" },
{ role: "zoomIn", label: "放大" },
{ role: "zoomOut", label: "缩小" },
{ type: "separator" },
{ role: "togglefullscreen" },
{ role: "togglefullscreen", label: "全屏" },
],
},
{
label: "Window",
label: "窗口",
submenu: isMac
? [{ role: "minimize" }, { role: "zoom" }, { type: "separator" }, { role: "front" }]
: [{ role: "minimize" }, { role: "close" }],
? [{ role: "minimize", label: "最小化" }, { role: "zoom" }, { type: "separator" }, { role: "front" }]
: [{ role: "minimize", label: "最小化" }, { role: "close", label: "关闭" }],
},
);

Expand All @@ -192,11 +192,11 @@ function getTrayIcon(filename: string) {
function updateTrayMenu(recording: boolean = false) {
if (!tray) return;
const trayIcon = recording ? recordingTrayIcon : defaultTrayIcon;
const trayToolTip = recording ? `Recording: ${selectedSourceName}` : "OpenScreen";
const trayToolTip = recording ? `正在录制: ${selectedSourceName}` : "OpenScreen";
const menuTemplate = recording
? [
{
label: "Stop Recording",
label: "停止录制",
click: () => {
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send("stop-recording-from-tray");
Expand All @@ -206,7 +206,7 @@ function updateTrayMenu(recording: boolean = false) {
]
: [
{
label: "Open",
label: "打开",
click: () => {
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.isMinimized() && mainWindow.restore();
Expand All @@ -216,7 +216,7 @@ function updateTrayMenu(recording: boolean = false) {
},
},
{
label: "Quit",
label: "退出",
click: () => {
app.quit();
},
Expand Down Expand Up @@ -251,12 +251,12 @@ function createEditorWindowWrapper() {

const choice = dialog.showMessageBoxSync(mainWindow!, {
type: "warning",
buttons: ["Save & Close", "Discard & Close", "Cancel"],
buttons: ["保存并关闭", "放弃并关闭", "取消"],
defaultId: 0,
cancelId: 2,
title: "Unsaved Changes",
message: "You have unsaved changes.",
detail: "Do you want to save your project before closing?",
title: "未保存的更改",
message: "您有未保存的更改。",
detail: "关闭前是否要保存项目?",
});

if (choice === 0) {
Expand Down
99 changes: 93 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
"fix-webm-duration": "^1.0.6",
"gif.js": "^0.2.0",
"gsap": "^3.13.0",
"i18next": "^25.8.18",
"lucide-react": "^0.545.0",
"mediabunny": "^1.25.1",
"motion": "^12.23.24",
"mp4box": "^2.2.0",
"pixi.js": "^8.14.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^16.5.8",
"react-icons": "^5.5.0",
"react-resizable-panels": "^3.0.6",
"react-rnd": "^10.5.2",
Expand Down
18 changes: 10 additions & 8 deletions src/components/launch/LaunchWindow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { BsRecordCircle } from "react-icons/bs";
import { FaRegStopCircle } from "react-icons/fa";
import { FaFolderOpen } from "react-icons/fa6";
Expand All @@ -12,6 +13,7 @@ import { AudioLevelMeter } from "../ui/audio-level-meter";
import styles from "./LaunchWindow.module.css";

export function LaunchWindow() {
const { t } = useTranslation();
const {
recording,
toggleRecording,
Expand Down Expand Up @@ -65,7 +67,7 @@ export function LaunchWindow() {
const s = (seconds % 60).toString().padStart(2, "0");
return `${m}:${s}`;
};
const [selectedSource, setSelectedSource] = useState("Screen");
const [selectedSource, setSelectedSource] = useState(t("launch.screen"));
const [hasSelectedSource, setHasSelectedSource] = useState(false);

useEffect(() => {
Expand All @@ -76,7 +78,7 @@ export function LaunchWindow() {
setSelectedSource(source.name);
setHasSelectedSource(true);
} else {
setSelectedSource("Screen");
setSelectedSource(t("launch.screen"));
setHasSelectedSource(false);
}
}
Expand Down Expand Up @@ -192,7 +194,7 @@ export function LaunchWindow() {
className={`${styles.hudIconBtn} ${systemAudioEnabled ? styles.hudIconActive : ""}`}
onClick={() => !recording && setSystemAudioEnabled(!systemAudioEnabled)}
disabled={recording}
title={systemAudioEnabled ? "Disable system audio" : "Enable system audio"}
title={systemAudioEnabled ? t("launch.disableSystemAudio") : t("launch.enableSystemAudio")}
>
{systemAudioEnabled ? (
<MdVolumeUp size={15} className="text-green-400" />
Expand All @@ -204,7 +206,7 @@ export function LaunchWindow() {
className={`${styles.hudIconBtn} ${microphoneEnabled ? styles.hudIconActive : ""}`}
onClick={toggleMicrophone}
disabled={recording}
title={microphoneEnabled ? "Disable microphone" : "Enable microphone"}
title={microphoneEnabled ? t("launch.disableMicrophone") : t("launch.enableMicrophone")}
>
{microphoneEnabled ? (
<MdMic size={15} className="text-green-400" />
Expand Down Expand Up @@ -241,7 +243,7 @@ export function LaunchWindow() {
className={`${styles.hudIconBtn} ${styles.electronNoDrag}`}
onClick={openVideoFile}
disabled={recording}
title="Open video file"
title={t("launch.openVideoFile")}
>
<MdVideoFile size={14} className="text-white/60" />
</button>
Expand All @@ -251,17 +253,17 @@ export function LaunchWindow() {
className={`${styles.hudIconBtn} ${styles.electronNoDrag}`}
onClick={openProjectFile}
disabled={recording}
title="Open project"
title={t("launch.openProject")}
>
<FaFolderOpen size={14} className="text-white/60" />
</button>

{/* Window controls */}
<div className={`flex items-center gap-0.5 ${styles.electronNoDrag}`}>
<button className={styles.windowBtn} title="Hide HUD" onClick={sendHudOverlayHide}>
<button className={styles.windowBtn} title={t("launch.hideHud")} onClick={sendHudOverlayHide}>
<FiMinus size={14} className="text-white" />
</button>
<button className={styles.windowBtn} title="Close App" onClick={sendHudOverlayClose}>
<button className={styles.windowBtn} title={t("launch.closeApp")} onClick={sendHudOverlayClose}>
<FiX size={14} className="text-white" />
</button>
</div>
Expand Down
Loading