界面:三维显示设置对话框的关闭按钮说中文(Qt 自带翻译没有被安装)

- What: `Scene3dSettingsDialog.retranslate()` 把 `QDialogButtonBox` 的 Close 按钮文字设为
  `t("dialog.close")`;两个 locale 各加一个 close 键。
- Why: 应用没有安装 Qt 自带的翻译文件,于是按钮框在满屏中文里显示一个英文 Close;对话框是这个
  面板唯一的出口按钮,不该是外来语。
- Verification: `.repro/locale_check.py` 0 缺失(新键双语齐备);对话框截图目视确认
  (266x531,结尾按钮为「关闭」)。
- Not in this change: 不动其它对话框(它们用自己的按钮,本来就有中文文案)。
This commit is contained in:
ykcheungab
2026-09-15 20:57:21 +08:00
parent 650578d738
commit 0b87e3e36d
3 changed files with 9 additions and 2 deletions
+2 -1
View File
@@ -78,7 +78,8 @@
"filter_nyquist": "Note: a {cutoff} Hz cutoff is at or above the Nyquist frequency of {nyquist} Hz (sample rate {rate} Hz) — the device would not filter. Lower the cutoff or pin a higher sample rate.", "filter_nyquist": "Note: a {cutoff} Hz cutoff is at or above the Nyquist frequency of {nyquist} Hz (sample rate {rate} Hz) — the device would not filter. Lower the cutoff or pin a higher sample rate.",
"filter_off": "Not filtering (raw readings)", "filter_off": "Not filtering (raw readings)",
"ok": "OK", "ok": "OK",
"cancel": "Cancel" "cancel": "Cancel",
"close": "Close"
}, },
"toolbar": { "toolbar": {
"search_cameras": "Search", "search_cameras": "Search",
+2 -1
View File
@@ -78,7 +78,8 @@
"filter_nyquist": "注意:低通 {cutoff} Hz 已达到或超过奈奎斯特频率 {nyquist} Hz(采样率 {rate} Hz)——设备不会滤。请调低截止频率或固定更高的采样率。", "filter_nyquist": "注意:低通 {cutoff} Hz 已达到或超过奈奎斯特频率 {nyquist} Hz(采样率 {rate} Hz)——设备不会滤。请调低截止频率或固定更高的采样率。",
"filter_off": "当前不滤波(原始读数)", "filter_off": "当前不滤波(原始读数)",
"ok": "确定", "ok": "确定",
"cancel": "取消" "cancel": "取消",
"close": "关闭"
}, },
"toolbar": { "toolbar": {
"search_cameras": "搜索", "search_cameras": "搜索",
@@ -70,6 +70,11 @@ class Scene3dSettingsDialog(QDialog):
def retranslate(self) -> None: def retranslate(self) -> None:
self.setWindowTitle(t("scene3d.settings_title")) self.setWindowTitle(t("scene3d.settings_title"))
self.hint.setText(t("scene3d.settings_hint")) self.hint.setText(t("scene3d.settings_hint"))
# Qt ships its own translations for a button box, and the application installs
# none: without this the dialog ends in an English "Close" among Chinese labels.
close_button = self.buttons.button(QDialogButtonBox.Close)
if close_button is not None:
close_button.setText(t("dialog.close"))
# ------------------------------------------------------------------ Qt events # ------------------------------------------------------------------ Qt events
def closeEvent(self, event) -> None: # noqa: N802 - Qt naming def closeEvent(self, event) -> None: # noqa: N802 - Qt naming