Skip to content

Commit 5e2952c

Browse files
committed
feat: 对滚动截屏进行国际化支持
1 parent 7993f5c commit 5e2952c

File tree

6 files changed

+119
-59
lines changed

6 files changed

+119
-59
lines changed

locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"app_title": "ScreenSniper - Screenshot Tool",
33
"btn_fullscreen": "Capture Full Screen (Ctrl+Shift+F)",
44
"btn_area": "Capture Area (Ctrl+Shift+A)",
5+
"btn_scroll": "Scroll Capture",
56
"btn_settings": "Settings",
67
"tray_fullscreen": "Capture Full Screen",
78
"tray_area": "Capture Area",
9+
"tray_scroll": "Scroll Capture",
810
"tray_show": "Show Main Window",
911
"tray_about": "About",
1012
"tray_quit": "Quit",
@@ -93,5 +95,7 @@
9395
"face_blur_init_failed": "Face detector initialization failed\n\nPossible reasons:\n1. Model files missing (opencv_face_detector_uint8.pb and opencv_face_detector.pbtxt.txt)\n2. OpenCV library not properly configured\n\nPlease check if model files exist in the models directory",
9496
"face_blur_not_ready": "Face detector is still not available after initialization\n\nPlease check:\n1. If model files are complete\n2. If OpenCV library is correctly installed",
9597
"face_blur_not_available_title": "Feature Unavailable",
96-
"face_blur_opencv_disabled": "Face recognition feature requires OpenCV support\n\nCurrent build has OpenCV disabled (NO_OPENCV is defined)\n\nTo enable this feature, please:\n1. Install OpenCV library\n2. Configure OpenCV path in ScreenSniper.pro\n3. Remove DEFINES += NO_OPENCV definition\n4. Rebuild the project"
98+
"face_blur_opencv_disabled": "Face recognition requires OpenCV support\n\nCurrent build has OpenCV disabled (NO_OPENCV defined)\n\nTo enable this feature:\n1. Install OpenCV library\n2. Configure OpenCV path in ScreenSniper.pro\n3. Remove DEFINES += NO_OPENCV\n4. Rebuild the project",
99+
"scroll_selection_size": "Selection Size: %1 x %2",
100+
"scroll_stop_button": "Stop"
97101
}

locales/zh.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"app_title": "ScreenSniper - 截图工具",
33
"btn_fullscreen": "截取全屏 (Ctrl+Shift+F)",
44
"btn_area": "截取区域 (Ctrl+Shift+A)",
5+
"btn_scroll": "滚动截图",
56
"btn_settings": "设置",
67
"tray_fullscreen": "截取全屏",
78
"tray_area": "截取区域",
9+
"tray_scroll": "滚动截图",
810
"tray_show": "显示主窗口",
911
"tray_about": "关于",
1012
"tray_quit": "退出",
@@ -93,5 +95,7 @@
9395
"face_blur_init_failed": "人脸检测器初始化失败\n\n可能的原因:\n1. 模型文件缺失(opencv_face_detector_uint8.pb 和 opencv_face_detector.pbtxt.txt)\n2. OpenCV 库未正确配置\n\n请检查 models 目录下是否有模型文件",
9496
"face_blur_not_ready": "人脸检测器初始化后仍不可用\n\n请检查:\n1. 模型文件是否完整\n2. OpenCV 库是否正确安装",
9597
"face_blur_not_available_title": "功能不可用",
96-
"face_blur_opencv_disabled": "人脸识别功能需要 OpenCV 支持\n\n当前编译版本已禁用 OpenCV(NO_OPENCV 已定义)\n\n要启用此功能,请:\n1. 安装 OpenCV 库\n2. 在 ScreenSniper.pro 中配置 OpenCV 路径\n3. 移除 DEFINES += NO_OPENCV 定义\n4. 重新编译项目"
98+
"face_blur_opencv_disabled": "人脸识别功能需要 OpenCV 支持\n\n当前编译版本已禁用 OpenCV(NO_OPENCV 已定义)\n\n要启用此功能,请:\n1. 安装 OpenCV 库\n2. 在 ScreenSniper.pro 中配置 OpenCV 路径\n3. 移除 DEFINES += NO_OPENCV 定义\n4. 重新编译项目",
99+
"scroll_selection_size": "选区大小: %1 x %2",
100+
"scroll_stop_button": "停止"
97101
}

locales/zhHK.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"app_title": "ScreenSniper - 截圖工具",
33
"btn_fullscreen": "截取全螢幕 (Ctrl+Shift+F)",
44
"btn_area": "截取區域 (Ctrl+Shift+A)",
5+
"btn_scroll": "滾動截圖",
56
"btn_settings": "設置",
67
"tray_fullscreen": "截取全螢幕",
78
"tray_area": "截取區域",
9+
"tray_scroll": "滾動截圖",
810
"tray_show": "顯示主視窗",
911
"tray_about": "關於",
1012
"tray_quit": "退出",
@@ -93,5 +95,7 @@
9395
"face_blur_init_failed": "人臉檢測器初始化失敗\n\n可能的原因:\n1. 模型文件缺失(opencv_face_detector_uint8.pb 和 opencv_face_detector.pbtxt.txt)\n2. OpenCV 庫未正確配置\n\n請檢查 models 目錄下是否有模型文件",
9496
"face_blur_not_ready": "人臉檢測器初始化後仍不可用\n\n請檢查:\n1. 模型文件是否完整\n2. OpenCV 庫是否正確安裝",
9597
"face_blur_not_available_title": "功能不可用",
96-
"face_blur_opencv_disabled": "人臉識別功能需要 OpenCV 支持\n\n當前編譯版本已禁用 OpenCV(NO_OPENCV 已定義)\n\n要啟用此功能,請:\n1. 安裝 OpenCV 庫\n2. 在 ScreenSniper.pro 中配置 OpenCV 路徑\n3. 移除 DEFINES += NO_OPENCV 定義\n4. 重新編譯項目"
98+
"face_blur_opencv_disabled": "人臉識別功能需要 OpenCV 支持\n\n當前編譯版本已禁用 OpenCV(NO_OPENCV 已定義)\n\n要啟用此功能,請:\n1. 安裝 OpenCV 庫\n2. 在 ScreenSniper.pro 中配置 OpenCV 路徑\n3. 移除 DEFINES += NO_OPENCV 定義\n4. 重新編譯項目",
99+
"scroll_selection_size": "選區大小: %1 x %2",
100+
"scroll_stop_button": "停止"
97101
}

mainwindow.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void MainWindow::setupUI()
7272
// 添加按钮(使用多语言文本)
7373
btnFullScreen = new QPushButton(getText("btn_fullscreen", "截取全屏 (Ctrl+Shift+F)"), this);
7474
btnArea = new QPushButton(getText("btn_area", "截取区域 (Ctrl+Shift+A)"), this);
75-
btnScroll = new QPushButton(getText("btnScroll ", "滚动截图"), this);
75+
btnScroll = new QPushButton(getText("btn_scroll", "滚动截图"), this);
7676
btnSettings = new QPushButton(getText("btn_settings", "设置"), this);
7777

7878
btnFullScreen->setMinimumHeight(40);
@@ -107,7 +107,7 @@ void MainWindow::setupTrayIcon()
107107

108108
actionFullScreen = new QAction(getText("tray_fullscreen", "截取全屏"), this);
109109
actionArea = new QAction(getText("tray_area", "截取区域"), this);
110-
actionScroll= new QAction(getText("tray_roll", "滚动截图"), this);
110+
actionScroll = new QAction(getText("tray_scroll", "滚动截图"), this);
111111
actionShow = new QAction(getText("tray_show", "显示主窗口"), this);
112112

113113
actionAbout = new QAction(getText("tray_about", "关于"), this);
@@ -206,7 +206,8 @@ void MainWindow::onCaptureScroll()
206206
hide();
207207
ScrollCaptureWindow *scrollWin = new ScrollCaptureWindow(nullptr);
208208

209-
connect(scrollWin, &ScrollCaptureWindow::captureFinished, this, [this](QImage result){
209+
connect(scrollWin, &ScrollCaptureWindow::captureFinished, this, [this](QImage result)
210+
{
210211
if(result.isNull()) {
211212
this->show();
212213
return;
@@ -215,8 +216,7 @@ void MainWindow::onCaptureScroll()
215216
// 直接进入 ScreenshotWidget 编辑/查看
216217
ScreenshotWidget *widget = new ScreenshotWidget();
217218
widget->setCapturedImage(result);
218-
widget->show();
219-
});
219+
widget->show(); });
220220

221221
QTimer::singleShot(300, scrollWin, &ScrollCaptureWindow::startCapture);
222222
}
@@ -325,8 +325,8 @@ void MainWindow::updateUI()
325325
btnFullScreen->setText(getText("btn_fullscreen", "截取全屏 (Ctrl+Shift+F)"));
326326
if (btnArea)
327327
btnArea->setText(getText("btn_area", "截取区域 (Ctrl+Shift+A)"));
328-
if (btnArea)
329-
btnArea->setText(getText("btn_area", "截取区域 (Ctrl+Shift+A)"));
328+
if (btnScroll)
329+
btnScroll->setText(getText("btn_scroll", "滚动截图"));
330330
if (btnSettings)
331331
btnSettings->setText(getText("btn_settings", "设置"));
332332

@@ -335,6 +335,8 @@ void MainWindow::updateUI()
335335
actionFullScreen->setText(getText("tray_fullscreen", "截取全屏"));
336336
if (actionArea)
337337
actionArea->setText(getText("tray_area", "截取区域"));
338+
if (actionScroll)
339+
actionScroll->setText(getText("tray_scroll", "滚动截图"));
338340
if (actionShow)
339341
actionShow->setText(getText("tray_show", "显示主窗口"));
340342
if (actionAbout)

0 commit comments

Comments
 (0)