feat: 完善 Web 界面国际化支持

- 将包含数字的无意义 i18n 键名替换为语义化名称 (如 kvm_text1 → about_title)
- 为缺失多语言支持的界面文本添加中英文翻译
- 修复不准确的翻译内容和 HTML 标签格式错误
- 更新所有 Pug 模板文件以使用新的 i18n 键名
- 新增登录页面"记住我"、USB 连接确认等功能的多语言支持
- 统一翻译键命名规范,提升代码可维护性
This commit is contained in:
mofeng-git
2025-08-21 13:23:33 +08:00
parent 2c056ca3e3
commit 19d1c52ac4
21 changed files with 459 additions and 444 deletions

View File

@@ -4,26 +4,26 @@ li.right#system-dropdown
+navbar_led("stream-led", "led-video")
+navbar_led("hid-keyboard-led", "led-hid-keyboard")
+navbar_led("hid-mouse-led", "led-hid-mouse")
span(i18n="kvm_text3") System
span(i18n="system_menu") System
.menu#system-menu
table.kv
tr
td.value(i18n="kvm_text4")
td.value(i18n="system_runtime_settings")
| Runtime settings & tools
td.feature-disabled#system-tool-webterm
button.small(data-force-hide-menu data-show-window="webterm-window" i18n="kvm_text5") • Term
button.small(data-force-hide-menu data-show-window="webterm-window" i18n="system_terminal") • Term
td#system-tool-about
button.small(data-force-hide-menu data-show-window="about-window" i18n="kvm_text6") • About
button.small(data-force-hide-menu data-show-window="about-window" i18n="system_about") • About
td#system-tool-log
button.small#open-log-button(data-force-hide-menu i18n="kvm_text7") • Log
button.small#open-log-button(data-force-hide-menu i18n="system_log") • Log
td.feature-disabled#system-tool-wol
button(
data-force-hide-menu
class="__gpio-button-__wol__ __gpio-button small"
data-channel="__wol__"
data-confirm="Are you sure to send Wake-on-LAN packet to the server?"
i18n="kvm_text8"
i18n="system_wol"
) • WoL
hr
@@ -39,70 +39,70 @@ li.right#system-dropdown
table.kv
tr.feature-disabled#stream-resolution
td(i18n="kvm_text9") Resolution:
td(i18n="video_resolution") Resolution:
td #[select#stream-resolution-selector(disabled)]
tr.feature-disabled#stream-quality
+menu_slider_td3("stream-quality-slider", "stream-quality-value", false, "kvm_text10") JPEG quality:
+menu_slider_td3("stream-quality-slider", "stream-quality-value", false, "video_jpeg_quality") JPEG quality:
tr
+menu_slider_td3("stream-desired-fps-slider", "stream-desired-fps-value", false, "kvm_text11") JPEG max fps:
+menu_slider_td3("stream-desired-fps-slider", "stream-desired-fps-value", false, "video_jpeg_fps") JPEG max fps:
tr.feature-disabled#stream-h264-bitrate
+menu_slider_td3("stream-h264-bitrate-slider", "stream-h264-bitrate-value", false, "kvm_text12") H.264 kbps:
+menu_slider_td3("stream-h264-bitrate-slider", "stream-h264-bitrate-value", false, "video_h264_bitrate") H.264 kbps:
tr.feature-disabled#stream-h264-gop
+menu_slider_td3("stream-h264-gop-slider", "stream-h264-gop-value", false, "kvm_text13") H.264 gop:
+menu_slider_td3("stream-h264-gop-slider", "stream-h264-gop-value", false, "video_h264_gop") H.264 gop:
tr.feature-disabled#stream-mode
+menu_radio_td2("stream-mode-radio", [
{title: "WebRTC<br>H.264", value: "janus"},
{title: "Direct<br>H.264", value: "media"},
{title: "Legacy<br>MJPEG", value: "mjpeg", checked: true},
], "kvm_text14") #[a(target="_blank" href="https://docs.pikvm.org/webrtc") Video mode]:
], "video_mode") #[a(target="_blank" href="https://docs.pikvm.org/webrtc" i18n="video_mode") Video mode]:
tr.feature-disabled#stream-orient
+menu_radio_td2("stream-orient-radio", [
{title: "Default", value: "0", checked: true},
{title: "90&deg;", value: "90"},
{title: "180&deg;", value: "180"},
{title: "270&deg;", value: "270"},
], "kvm_text17") Orientation:
], "video_orientation") Orientation:
tr.feature-disabled#stream-audio
+menu_slider_td3("stream-audio-volume-slider", "stream-audio-volume-value", false, "kvm_text19") Audio volume:
+menu_slider_td3("stream-audio-volume-slider", "stream-audio-volume-value", false, "audio_volume") Audio volume:
tr.feature-disabled#stream-mic
+menu_switch_td2("stream-mic-switch", false, "stream-mic-switch") Microphone:
hr
.buttons.buttons-row
button.row33(data-force-hide-menu data-show-window="stream-window" i18n="kvm_text20") &bull; Show stream
button.row33#stream-screenshot-button(data-force-hide-menu i18n="kvm_text21") &bull; Screenshot
button.row33#stream-reset-button( i18n="kvm_text22") Reset stream
button.row33(data-force-hide-menu data-show-window="stream-window" i18n="stream_show") &bull; Show stream
button.row33#stream-screenshot-button(data-force-hide-menu i18n="stream_screenshot") &bull; Screenshot
button.row33#stream-reset-button( i18n="stream_reset") Reset stream
hr
.text
b(i18n="kvm_text79") Video Record#[br]
sub(i18n="kvm_text80") Record video using the browser API, and will be downloaded automatically
b(i18n="video_record_title") Video Record#[br]
sub(i18n="video_record_description") Record video using the browser API, and will be downloaded automatically
.buttons.buttons-row
button.row50#stream-record-start-button(data-force-hide-menu i18n="kvm_text81") &bull; Start recording
button.row50#stream-record-stop-button(data-force-hide-menu i18n="kvm_text82") &bull; End recording
button.row50#stream-record-start-button(data-force-hide-menu i18n="video_record_start") &bull; Start recording
button.row50#stream-record-stop-button(data-force-hide-menu i18n="video_record_stop") &bull; End recording
hr
table.kv
tr.feature-disabled#hid-outputs-keyboard
td(i18n="kvm_text23") Keyboard mode:
td(i18n="hid_keyboard_mode") Keyboard mode:
td #[div.radio-box#hid-outputs-keyboard-box]
tr.feature-disabled#hid-outputs-mouse
td #[a(target="_blank" href="https://docs.pikvm.org/mouse" i18n="kvm_text24") Mouse mode]:
td #[a(target="_blank" href="https://docs.pikvm.org/mouse" i18n="hid_mouse_mode") Mouse mode]:
td #[div.radio-box#hid-outputs-mouse-box]
+menu_spoiler("Keyboard &amp; mouse (HID) settings", "kvm_text25")
+menu_spoiler("Keyboard &amp; mouse (HID) settings", "hid_settings")
+menu_switch_table("hid-keyboard-swap-cc-switch", true, false, "hid-keyboard-swap-cc-switch") Swap Left Ctrl and Caps keys:
hr
table(class="kv")
tr
+menu_slider_td3("hid-mouse-rate-slider", "hid-mouse-rate-value", false, "kvm_text26") Mouse polling:
+menu_slider_td3("hid-mouse-rate-slider", "hid-mouse-rate-value", false, "hid_mouse_polling") Mouse polling:
tr.feature-disabled#hid-mouse-sens
+menu_slider_td3("hid-mouse-sens-slider", "hid-mouse-sens-value", false, "kvm_text27") Relative sensitivity:
+menu_slider_td3("hid-mouse-sens-slider", "hid-mouse-sens-value", false, "hid_mouse_sensitivity") Relative sensitivity:
tr(id="hid-mouse-squash" class="feature-disabled")
+menu_switch_td2("hid-mouse-squash-switch", false, "hid-mouse-squash-switch") Squash relative moves:
+menu_switch_td2("hid-mouse-squash-switch", false, false, "hid-mouse-squash-switch") Squash relative moves:
tr
td Reverse scrolling:
td(i18n="hid_mouse_reverse_scroll") Reverse scrolling:
td
table
tr
@@ -112,11 +112,11 @@ li.right#system-dropdown
tr
+menu_switch_td2("hid-mouse-cumulative-scrolling-switch", true, false, "hid-mouse-cumulative-scrolling-switch") Cumulative scrolling:
tr
+menu_slider_td3("hid-mouse-scroll-slider", "hid-mouse-scroll-value", true, "kvm_text29") Scroll rate:
+menu_slider_td3("hid-mouse-scroll-slider", "hid-mouse-scroll-value", true, "hid_mouse_scroll_rate") Scroll rate:
tr
+menu_switch_td2("hid-mouse-dot-switch", true, true, "hid-mouse-dot-switch") Show the blue dot:
+menu_spoiler("Web UI settings")
+menu_spoiler("Web UI settings", "web_ui_settings")
table.kv
tr
+menu_switch_td2("page-close-ask-switch", true, true, "page-close-ask-switch") Ask page close confirmation:
@@ -138,12 +138,15 @@ li.right#system-dropdown
tr.feature-disabled#v3-usb-breaker
+menu_switch_td2_gpio(
"__v3_usb_breaker__",
"Turning off this switch will disconnect the main USB from the server. Are you sure you want to continue?"
) Connect main USB to Server:
"Turning off this switch will disconnect the main USB from the server. Are you sure you want to continue?",
"usb_breaker_confirm"
)
span(i18n="usb_connect_main") Connect main USB to Server:
tr.feature-disabled#v4-locator
+menu_switch_td2_gpio("__v4_locator__") Enable locator LED:
+menu_switch_td2_gpio("__v4_locator__", "","locator_led_enable")
span(i18n="locator_led_enable") Enable locator LED:
hr
.buttons.buttons-row
button.row50(data-force-hide-menu data-show-window="keyboard-window" i18n="kvm_text30") &bull; Show keyboard
button.row50#hid-reset-button(disabled i18n="kvm_text31") Reset HID
button.row50(data-force-hide-menu data-show-window="keyboard-window" i18n="hid_show_keyboard") &bull; Show keyboard
button.row50#hid-reset-button(disabled i18n="hid_reset") Reset HID