From 337e1d3ea4ce5a7bc132fd2b3495b2e9e89e905d Mon Sep 17 00:00:00 2001 From: codex Date: Sat, 7 Nov 2026 04:18:58 +0800 Subject: [PATCH] feat(i18n): bind user pages to published copy --- web/app/Controllers/CloudPageController.php | 15 ++ web/app/Controllers/UserController.php | 9 + .../Services/UserCopy/UserCopyViewRuntime.php | 106 ++++++++ web/public/cloud/client.css | 5 + web/public/cloud/toast.js | 7 +- web/public/cloud/user-copy-runtime.js | 230 ++++++++++++++++++ web/public/theme/venix/js/user-home.js | 39 +-- web/resources/user-copy/manifest.php | 66 +++++ web/resources/views/venix/cloud/page.tpl | 3 +- web/resources/views/venix/layout_assets.tpl | 2 +- .../views/venix/user/layout_header.tpl | 3 +- .../views/venix/user/layout_plain_header.tpl | 3 +- .../views/venix/user/panel_sidebar.tpl | 48 ++-- .../views/venix/user/panel_topbar.tpl | 27 +- .../views/venix/user/user_copy_bootstrap.tpl | 2 + web/tests/CloudAssetVersionContractTest.php | 2 +- ...loudInvoiceListPerformanceContractTest.php | 2 +- web/tests/CloudUserBackupUiContractTest.php | 4 +- web/tests/TemplateCompilationTest.php | 2 + web/tests/UserAnnouncementDrawerViewTest.php | 10 + web/tests/UserCopyBrowserRuntimeTest.mjs | 55 +++++ .../UserCopyRuntimeNoDatabaseContractTest.php | 18 +- web/tests/UserCopyUserRuntimeTest.php | 106 ++++++++ web/tests/VirtualizationAssetsTest.php | 10 +- 24 files changed, 701 insertions(+), 73 deletions(-) create mode 100644 web/app/Services/UserCopy/UserCopyViewRuntime.php create mode 100644 web/public/cloud/user-copy-runtime.js create mode 100644 web/resources/views/venix/user/user_copy_bootstrap.tpl create mode 100644 web/tests/UserCopyBrowserRuntimeTest.mjs create mode 100644 web/tests/UserCopyUserRuntimeTest.php diff --git a/web/app/Controllers/CloudPageController.php b/web/app/Controllers/CloudPageController.php index 3ea09f92..ea2ab0fe 100644 --- a/web/app/Controllers/CloudPageController.php +++ b/web/app/Controllers/CloudPageController.php @@ -19,6 +19,7 @@ use App\Services\Cloud\CloudUserPageView; use App\Services\Cloud\CloudVpcFeature; use App\Services\Cloud\CloudVpcService; use App\Services\UserDrawerService; +use App\Services\UserCopy\UserCopyViewRuntime; use App\Services\View; /** User pages deliberately do not load the administrator theme styles. */ @@ -400,6 +401,20 @@ final class CloudPageController private function render($response, $page, $title, $vmId = '', $invoiceId = '', array $values = []) { $smarty = View::getSmarty('venix'); + $copyPage = [ + 'instances' => 'cloud.instances', 'detail' => 'cloud.detail', + 'deploy' => 'cloud.deploy', 'backups' => 'cloud.backups', + 'cloud-snapshots' => 'cloud.snapshots', + 'traffic' => 'cloud.traffic', 'vpcs' => 'cloud.vpcs', + 'isos' => 'cloud.isos', 'keys' => 'cloud.keys', + 'invoices' => 'cloud.invoices', + 'invoice-detail' => 'cloud.invoice_detail', + 'reinstall' => 'cloud.reinstall', + ][$page] ?? null; + UserCopyViewRuntime::production()->bindCurrentRequest( + $smarty, + $copyPage + ); $smarty->assign('cloud_page', $page); $smarty->assign('cloud_page_module', [ 'instances' => 'instances', 'detail' => 'detail', 'deploy' => 'deploy', diff --git a/web/app/Controllers/UserController.php b/web/app/Controllers/UserController.php index ea2a6e45..968d8a42 100644 --- a/web/app/Controllers/UserController.php +++ b/web/app/Controllers/UserController.php @@ -42,6 +42,7 @@ use App\Services\Ticket\TicketThreadQuery; use App\Services\Ticket\TicketViewer; use App\Services\Ticket\TicketReadCommand; use App\Services\UserDrawerService; +use App\Services\UserCopy\UserCopyViewRuntime; /** * Account and ticket pages. @@ -88,6 +89,14 @@ class UserController extends BaseController public function smarty() { $smarty = parent::smarty(); + $requestPath = parse_url( + isset($_SERVER['REQUEST_URI']) ? (string) $_SERVER['REQUEST_URI'] : '/', + PHP_URL_PATH + ); + if (!is_string($requestPath) + || !str_starts_with($requestPath, '/admin')) { + UserCopyViewRuntime::production()->bindCurrentRequest($smarty); + } $smarty->assign('cdn', isset($this->cdn) ? $this->cdn : ''); $smarty->assign('backup_cdn', isset($this->backup_cdn) ? $this->backup_cdn : ''); $smarty->assign('account_csrf_token', AdminCsrf::token()); diff --git a/web/app/Services/UserCopy/UserCopyViewRuntime.php b/web/app/Services/UserCopy/UserCopyViewRuntime.php new file mode 100644 index 00000000..65e2b63c --- /dev/null +++ b/web/app/Services/UserCopy/UserCopyViewRuntime.php @@ -0,0 +1,106 @@ + $requested, + ], time() + PublicLocale::COOKIE_TTL); + $cookies[PublicLocale::COOKIE_NAME] = $requested; + } + $locale = PublicLocale::resolve( + $query, + $cookies, + isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) + ? (string) $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '' + ); + $requestUri = isset($_SERVER['REQUEST_URI']) + ? (string) $_SERVER['REQUEST_URI'] : '/'; + + return $this->bind($smarty, $locale, $requestUri, $page); + } + + public function bind( + Smarty $smarty, + string $locale, + string $requestUri, + ?string $page = null + ): UserCopyCatalog { + $catalog = $page === null + ? new UserCopyCatalog($this->reader, $locale, ['common']) + : UserCopyCatalog::forPage($this->reader, $locale, $page); + $snapshot = $catalog->catalog(); + $bootstrap = json_encode([ + 'schema' => 1, + 'locale' => $catalog->locale(), + 'generation' => $catalog->generation(), + 'messages' => $snapshot['messages'], + 'metadata' => $snapshot['metadata'], + ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES + | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT + | JSON_THROW_ON_ERROR); + + $smarty->assign([ + 'user_copy_locale' => $catalog->locale(), + 'user_copy_generation' => $catalog->generation(), + 'user_copy_bootstrap_json' => $bootstrap, + 'user_copy_language_zh_url' => PublicLocale::switchUrl( + PublicLocale::CHINESE, + $requestUri + ), + 'user_copy_language_en_url' => PublicLocale::switchUrl( + PublicLocale::ENGLISH, + $requestUri + ), + ]); + $smarty->registerPlugin( + 'function', + 'user_copy', + static function (array $parameters) use ($catalog): string { + $key = isset($parameters['key']) + ? (string) $parameters['key'] : ''; + unset($parameters['key']); + return htmlspecialchars( + $catalog->text($key, $parameters), + ENT_QUOTES | ENT_SUBSTITUTE, + 'UTF-8' + ); + } + ); + + return $catalog; + } +} diff --git a/web/public/cloud/client.css b/web/public/cloud/client.css index ec9db2e5..3da58b3c 100644 --- a/web/public/cloud/client.css +++ b/web/public/cloud/client.css @@ -197,6 +197,11 @@ html.panel-task-open .panel-sidebar { transform: translate3d(0, calc(0px - var(- .panel-user-menu-options button:hover, .panel-user-menu-options button:focus-visible { background: #edf6f6; color: #117f88; outline: none; } .panel-user-menu-options button i { width: 18px; color: #2b9da5; font-size: 17px; text-align: center; } +.panel-user-menu-language { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; margin-top: 3px; padding-top: 7px; border-top: 1px solid #e6edf1; } +.panel-user-menu-language a { display: grid; min-height: 32px; place-items: center; border-radius: 7px; color: #6f8190; font-size: 11px; font-weight: 800; text-decoration: none; } +.panel-user-menu-language a:hover, +.panel-user-menu-language a:focus-visible { background: #edf6f6; color: #117f88; outline: none; } +.panel-user-menu-language a[aria-current="true"] { background: #def4f2; color: #0d858e; } html.panel-account-open { overflow: hidden; overscroll-behavior: none; scroll-behavior: auto !important; } html.panel-account-open body { position: fixed; top: var(--panel-account-scroll-top, 0px); left: 0; right: 0; width: 100%; overflow: hidden; } .panel-account-drawer { position: fixed; inset: 0 0 0 auto; display: none; width: min(540px, 100%); max-width: 100%; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #f4f7fb; color: #25384e; box-shadow: -14px 0 52px rgba(19,42,65,.18); overflow: hidden; } diff --git a/web/public/cloud/toast.js b/web/public/cloud/toast.js index f7e63570..ac1fd904 100644 --- a/web/public/cloud/toast.js +++ b/web/public/cloud/toast.js @@ -1,6 +1,7 @@ let activeToast = null; let activeTimer = null; let toastSequence = 0; +const i18n = globalThis.VenixUserCopy; const ICONS = Object.freeze({ success: 'mdi-check-circle-outline', @@ -28,7 +29,7 @@ export function toast(message, kind = '', title = '') { if (!region) return; const type = kind === 'error' || kind === 'warning' ? kind : 'success'; - const heading = title || (type === 'error' ? '操作失败' : '操作完成'); + const heading = title || i18n.text(`common.toast.${type}.title`); const duration = type === 'error' ? 4600 : 3200; if (activeToast) dismiss(activeToast); @@ -50,10 +51,10 @@ export function toast(message, kind = '', title = '') { titleElement.className = 'cloud-toast-title'; titleElement.textContent = heading; messageElement.className = 'cloud-toast-message'; - messageElement.textContent = message || '操作已完成。'; + messageElement.textContent = message || i18n.text('common.toast.success.body'); close.className = 'cloud-toast-close'; close.type = 'button'; - close.setAttribute('aria-label', '关闭提示'); + close.setAttribute('aria-label', i18n.text('common.toast.close.aria')); close.innerHTML = ''; copy.append(titleElement, messageElement); diff --git a/web/public/cloud/user-copy-runtime.js b/web/public/cloud/user-copy-runtime.js new file mode 100644 index 00000000..e4d4c00d --- /dev/null +++ b/web/public/cloud/user-copy-runtime.js @@ -0,0 +1,230 @@ +(function (root) { + 'use strict'; + + const source = root.document?.getElementById('user-copy-bootstrap'); + let payload = {}; + try { + payload = JSON.parse(source?.textContent || '{}'); + } catch { + payload = {}; + } + const locale = typeof payload.locale === 'string' && payload.locale + ? payload.locale : 'zh-CN'; + const messages = payload.messages && typeof payload.messages === 'object' + ? payload.messages : {}; + const metadata = payload.metadata && typeof payload.metadata === 'object' + ? payload.metadata : {}; + + function matchingBrace(pattern, start) { + let depth = 0; + let quoted = false; + for (let index = start; index < pattern.length; index += 1) { + const character = pattern[index]; + if (character === "'") { + if (pattern[index + 1] === "'") { + index += 1; + } else { + quoted = !quoted; + } + continue; + } + if (quoted) continue; + if (character === '{') depth += 1; + if (character === '}') { + depth -= 1; + if (depth === 0) return index; + } + } + return -1; + } + + function splitArgument(argument) { + const parts = []; + let depth = 0; + let quoted = false; + let start = 0; + for (let index = 0; index < argument.length; index += 1) { + const character = argument[index]; + if (character === "'") { + if (argument[index + 1] === "'") index += 1; + else quoted = !quoted; + continue; + } + if (quoted) continue; + if (character === '{') depth += 1; + else if (character === '}') depth -= 1; + else if (character === ',' && depth === 0 && parts.length < 2) { + parts.push(argument.slice(start, index).trim()); + start = index + 1; + } + } + parts.push(argument.slice(start).trim()); + return parts; + } + + function choices(style) { + const result = {}; + let offset = 0; + let cursor = 0; + const offsetMatch = style.match(/^\s*offset\s*:\s*(\d+(?:\.\d+)?)\s*/); + if (offsetMatch) { + offset = Number(offsetMatch[1]); + cursor = offsetMatch[0].length; + } + while (cursor < style.length) { + while (/\s/.test(style[cursor] || '')) cursor += 1; + const selectorStart = cursor; + while (cursor < style.length && !/[\s{]/.test(style[cursor])) cursor += 1; + const selector = style.slice(selectorStart, cursor); + while (/\s/.test(style[cursor] || '')) cursor += 1; + if (!selector || style[cursor] !== '{') return null; + const end = matchingBrace(style, cursor); + if (end < 0) return null; + result[selector] = style.slice(cursor + 1, end); + cursor = end + 1; + } + return { offset, values: result }; + } + + function formatArgument(argument, parameters, pluralValue) { + const parts = splitArgument(argument); + const name = parts[0]; + if (!Object.prototype.hasOwnProperty.call(parameters, name)) { + return `{${argument}}`; + } + const value = parameters[name]; + if (parts.length === 1) return String(value); + const type = String(parts[1] || '').toLowerCase(); + const style = parts[2] || ''; + if (type === 'plural' || type === 'selectordinal') { + const parsed = choices(style); + const numeric = Number(value); + if (!parsed || !Number.isFinite(numeric)) return `{${argument}}`; + const exact = `=${numeric}`; + const adjusted = numeric - parsed.offset; + const category = new Intl.PluralRules(locale, { + type: type === 'selectordinal' ? 'ordinal' : 'cardinal', + }).select(adjusted); + const selected = parsed.values[exact] + ?? parsed.values[category] ?? parsed.values.other; + return typeof selected === 'string' + ? formatPattern(selected, parameters, adjusted) : `{${argument}}`; + } + if (type === 'select') { + const parsed = choices(style); + if (!parsed) return `{${argument}}`; + const selected = parsed.values[String(value)] ?? parsed.values.other; + return typeof selected === 'string' + ? formatPattern(selected, parameters, pluralValue) : `{${argument}}`; + } + if (type === 'number') { + const numeric = Number(value); + if (!Number.isFinite(numeric)) return `{${argument}}`; + if (style === 'integer') { + return number(numeric, { maximumFractionDigits: 0 }); + } + if (style === 'percent') { + return number(numeric, { style: 'percent' }); + } + return number(numeric); + } + if (type === 'date' || type === 'time') { + const parsed = new Date(Number(value) < 1e12 + ? Number(value) * 1000 : value); + if (!Number.isFinite(parsed.getTime())) return `{${argument}}`; + const options = type === 'date' + ? { dateStyle: style || 'medium' } + : { timeStyle: style || 'medium', hour12: false }; + return new Intl.DateTimeFormat(locale, options).format(parsed); + } + return `{${argument}}`; + } + + function formatPattern(pattern, parameters, pluralValue = null) { + let output = ''; + for (let index = 0; index < pattern.length; index += 1) { + const character = pattern[index]; + if (character === "'") { + if (pattern[index + 1] === "'") { + output += "'"; + index += 1; + continue; + } + const end = pattern.indexOf("'", index + 1); + if (end >= 0) { + output += pattern.slice(index + 1, end); + index = end; + continue; + } + } + if (character === '{') { + const end = matchingBrace(pattern, index); + if (end >= 0) { + output += formatArgument( + pattern.slice(index + 1, end), parameters, pluralValue + ); + index = end; + continue; + } + } + if (character === '#' && pluralValue !== null) { + output += number(pluralValue); + } else { + output += character; + } + } + return output; + } + + function text(key, parameters = {}) { + const message = typeof messages[key] === 'string' ? messages[key] : key; + const descriptor = metadata[key] && typeof metadata[key] === 'object' + ? metadata[key] : {}; + if (descriptor.hidden === true) return ''; + if (descriptor.format !== 'icu') return message; + return formatPattern(message, parameters); + } + + function number(value, options = {}) { + const parsed = Number(value); + return Number.isFinite(parsed) + ? new Intl.NumberFormat(locale, options).format(parsed) : '—'; + } + + function currency(value, currencyCode = 'USD', options = {}) { + return number(value, { + style: 'currency', currency: currencyCode, ...options, + }); + } + + function date(value, options = {}) { + const numeric = Number(value); + const timestamp = Number.isFinite(numeric) && numeric > 0 + ? (numeric < 1e12 ? numeric * 1000 : numeric) + : Date.parse(String(value || '')); + const parsed = new Date(timestamp); + return Number.isFinite(parsed.getTime()) + ? new Intl.DateTimeFormat(locale, { + dateStyle: 'medium', timeStyle: 'medium', hour12: false, ...options, + }).format(parsed) + : '—'; + } + + function bytes(value, options = {}) { + let amount = Number(value); + if (!Number.isFinite(amount) || amount < 0) return '—'; + const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']; + let unit = 0; + while (amount >= 1024 && unit < units.length - 1) { + amount /= 1024; + unit += 1; + } + const maximumFractionDigits = unit === 0 ? 0 : amount >= 100 ? 0 + : amount >= 10 ? 1 : 2; + return `${number(amount, { maximumFractionDigits, ...options })} ${units[unit]}`; + } + + root.VenixUserCopy = Object.freeze({ + locale, text, number, currency, date, bytes, + }); +}(globalThis)); diff --git a/web/public/theme/venix/js/user-home.js b/web/public/theme/venix/js/user-home.js index c2fa41cb..15d6af89 100644 --- a/web/public/theme/venix/js/user-home.js +++ b/web/public/theme/venix/js/user-home.js @@ -44,8 +44,8 @@ if (toggle) { toggle.setAttribute("aria-pressed", next === "dark" ? "true" : "false"); toggle.innerHTML = next === "dark" - ? '亮色' - : '暗色'; + ? '' + window.VenixUserCopy.text("common.theme.light") + '' + : '' + window.VenixUserCopy.text("common.theme.dark") + ''; } } @@ -65,11 +65,12 @@ function showToast(options) { var config = options || {}; + var userCopy = window.VenixUserCopy; var region = qs("#vuToastRegion"); var mode = config.mode === "confirm" ? "confirm" : "alert"; var type = config.type === "error" || config.type === "warning" ? config.type : "success"; - var title = config.title || (type === "error" ? "操作失败" : mode === "confirm" ? "确认操作" : "操作完成"); - var message = config.message || (mode === "confirm" ? "确认继续?" : "操作已完成"); + var title = config.title || (mode === "confirm" ? userCopy.text("common.dialog.confirm.title") : userCopy.text("common.toast." + type + ".title")); + var message = config.message || (mode === "confirm" ? userCopy.text("common.dialog.confirm.body") : userCopy.text("common.toast.success.body")); var defaultDuration = mode === "confirm" ? 8000 : type === "error" ? 4600 : 2800; var duration = Number(config.duration); @@ -112,7 +113,7 @@ body.textContent = message; close.className = "vu-toast-close"; close.type = "button"; - close.setAttribute("aria-label", "关闭提示"); + close.setAttribute("aria-label", userCopy.text("common.toast.close.aria")); close.innerHTML = ''; copy.appendChild(heading); @@ -146,10 +147,10 @@ actions.className = "vu-toast-actions"; cancel.className = "vu-btn vu-btn-ghost vu-btn-small"; cancel.type = "button"; - cancel.textContent = config.cancelText || "取消"; + cancel.textContent = config.cancelText || userCopy.text("common.dialog.cancel"); confirm.className = "vu-btn vu-btn-small"; confirm.type = "button"; - confirm.textContent = config.confirmText || "确认"; + confirm.textContent = config.confirmText || userCopy.text("common.dialog.confirm"); cancel.addEventListener("click", function () { finish(false); }); confirm.addEventListener("click", function () { finish(true); }); actions.appendChild(cancel); @@ -175,9 +176,9 @@ return openModal({ mode: "alert", type: type || "success", - title: title || (type === "error" ? "操作失败" : "操作完成"), - message: message || "操作已完成", - confirmText: "知道了" + title: title || window.VenixUserCopy.text("common.toast." + (type === "error" ? "error" : "success") + ".title"), + message: message || window.VenixUserCopy.text("common.toast.success.body"), + confirmText: window.VenixUserCopy.text("common.dialog.acknowledge") }); } @@ -185,10 +186,10 @@ return openModal({ mode: "confirm", type: type || "warning", - title: title || "确认操作", - message: message || "确认继续?", - confirmText: "确认", - cancelText: "取消" + title: title || window.VenixUserCopy.text("common.dialog.confirm.title"), + message: message || window.VenixUserCopy.text("common.dialog.confirm.body"), + confirmText: window.VenixUserCopy.text("common.dialog.confirm"), + cancelText: window.VenixUserCopy.text("common.dialog.cancel") }); } @@ -229,11 +230,11 @@ }); } return response.text().then(function (text) { - if (!text) return { ret: 1, msg: "操作已提交" }; + if (!text) return { ret: 1, msg: window.VenixUserCopy.text("common.request.submitted") }; try { return JSON.parse(text); } catch (error) { - return { ret: 1, msg: "操作已提交" }; + return { ret: 1, msg: window.VenixUserCopy.text("common.request.submitted") }; } }); } @@ -277,7 +278,7 @@ function copyText(text) { if (!text) { - alertModal("没有可复制的内容", "error"); + alertModal(window.VenixUserCopy.text("common.copy.empty"), "error"); return Promise.resolve(false); } if (navigator.clipboard && window.isSecureContext) { @@ -317,9 +318,9 @@ if (!button) return; event.preventDefault(); copyText(button.getAttribute("data-copy")).then(function (ok) { - if (!ok) alertModal("复制失败,请手动复制", "error"); + if (!ok) alertModal(window.VenixUserCopy.text("common.copy.failed"), "error"); }).catch(function () { - alertModal("复制失败,请手动复制", "error"); + alertModal(window.VenixUserCopy.text("common.copy.failed"), "error"); }); }); diff --git a/web/resources/user-copy/manifest.php b/web/resources/user-copy/manifest.php index 7adb9107..8319c3f6 100644 --- a/web/resources/user-copy/manifest.php +++ b/web/resources/user-copy/manifest.php @@ -7,6 +7,25 @@ * here. English and every other target-locale translation are maintained by * administrators and must never be committed to this source manifest. */ +$common = static function ( + string $key, + string $source, + string $kind = 'label' +): array { + return [ + 'key' => $key, + 'scope' => 'common', + 'page' => 'cloud.instances', + 'kind' => $kind, + 'source' => $source, + 'format' => 'plain_text', + 'parameters' => [], + 'criticality' => 'required', + 'allow_hide' => false, + 'toast_tone' => null, + ]; +}; + return [ 'version' => 1, 'pages' => [ @@ -36,6 +55,53 @@ return [ 'user.tickets' => ['label' => '工单页', 'scopes' => ['common', 'tickets']], ], 'entries' => [ + $common('common.shell.user_center', '用户中心', 'navigation'), + $common('common.shell.sidebar.aria', '用户中心侧栏', 'aria_label'), + $common('common.shell.navigation.aria', '用户中心主导航', 'aria_label'), + $common('common.shell.navigation.toggle', '导航', 'button'), + $common('common.shell.navigation.expand.aria', '展开用户中心导航', 'aria_label'), + $common('common.shell.navigation.collapse.aria', '收起用户中心导航', 'aria_label'), + $common('common.shell.section.cloud', '云资源', 'navigation'), + $common('common.shell.section.support', '支持', 'navigation'), + $common('common.shell.nav.instances', '我的实例', 'navigation'), + $common('common.shell.nav.deploy', '部署实例', 'navigation'), + $common('common.shell.nav.backups', '云备份', 'navigation'), + $common('common.shell.nav.snapshots', '云快照', 'navigation'), + $common('common.shell.nav.traffic', '流量池', 'navigation'), + $common('common.shell.nav.vpc', 'VPC 私网', 'navigation'), + $common('common.shell.nav.iso', 'ISO 上传', 'navigation'), + $common('common.shell.nav.ssh_keys', 'SSH 公钥', 'navigation'), + $common('common.shell.nav.billing', '账单信息', 'navigation'), + $common('common.shell.nav.tickets', '工单支持', 'navigation'), + $common('common.shell.nav.admin', '管理员后台', 'navigation'), + $common('common.shell.nav.logout', '退出登录', 'navigation'), + $common('common.shell.task_center.open.aria', '打开任务中心', 'aria_label'), + $common('common.shell.task_center.title', '任务中心', 'tooltip'), + $common('common.shell.announcements.open.aria', '查看公告与维护信息', 'aria_label'), + $common('common.shell.announcements.title', '公告与维护信息', 'tooltip'), + $common('common.shell.account.menu.aria', '打开账户菜单', 'aria_label'), + $common('common.shell.account.menu', '账户菜单', 'aria_label'), + $common('common.shell.account.fallback', '账户', 'label'), + $common('common.shell.account.settings', '账户设置', 'navigation'), + $common('common.shell.account.settings.description', '管理双重认证、登录邮箱和密码', 'description'), + $common('common.shell.account.balance', '余额充值', 'navigation'), + $common('common.shell.account.balance.description', '选择充值金额和可用支付方式', 'description'), + $common('common.shell.account.promotion', '推广', 'navigation'), + $common('common.shell.account.promotion.description', '分享邀请链接并查看推广返利', 'description'), + $common('common.shell.language.aria', '选择语言', 'aria_label'), + $common('common.shell.language.chinese', '简体中文', 'label'), + $common('common.shell.language.english', '英语', 'label'), + $common('common.shell.powered_by', '由 libvirt 提供虚拟化支持', 'description'), + $common('common.theme.light', '亮色', 'label'), + $common('common.theme.dark', '暗色', 'label'), + $common('common.dialog.confirm.title', '确认操作', 'title'), + $common('common.dialog.confirm.body', '确认继续?', 'confirmation'), + $common('common.dialog.cancel', '取消', 'button'), + $common('common.dialog.confirm', '确认', 'button'), + $common('common.dialog.acknowledge', '知道了', 'button'), + $common('common.request.submitted', '操作已提交', 'status'), + $common('common.copy.empty', '没有可复制的内容', 'notice'), + $common('common.copy.failed', '复制失败,请手动复制', 'warning'), [ 'key' => 'common.toast.close.aria', 'scope' => 'common', diff --git a/web/resources/views/venix/cloud/page.tpl b/web/resources/views/venix/cloud/page.tpl index c0b8a1c8..a1d90cce 100644 --- a/web/resources/views/venix/cloud/page.tpl +++ b/web/resources/views/venix/cloud/page.tpl @@ -1,6 +1,6 @@ {include file='layout_assets.tpl'} - + @@ -57,6 +57,7 @@ {/if} {if $cloud_page == 'detail'}{include file='cloud/console.tpl'}{/if} +{include file='user/user_copy_bootstrap.tpl'} diff --git a/web/resources/views/venix/layout_assets.tpl b/web/resources/views/venix/layout_assets.tpl index a1ff89a5..7a94059f 100644 --- a/web/resources/views/venix/layout_assets.tpl +++ b/web/resources/views/venix/layout_assets.tpl @@ -1,2 +1,2 @@ {* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *} -{assign var=venix_asset_version value='2026110605' scope='global'} +{assign var=venix_asset_version value='2026110701' scope='global'} diff --git a/web/resources/views/venix/user/layout_header.tpl b/web/resources/views/venix/user/layout_header.tpl index 0cf9d2e1..8389b70b 100644 --- a/web/resources/views/venix/user/layout_header.tpl +++ b/web/resources/views/venix/user/layout_header.tpl @@ -1,5 +1,5 @@ - + {include file='user/layout_assets.tpl'} {assign var=vu_page_title value=$vu_title|default:''} {assign var=vu_active_key value=$vu_active|default:'' scope='global'} @@ -20,6 +20,7 @@ +{include file='user/user_copy_bootstrap.tpl'}
{include file='user/panel_sidebar.tpl' panel_active=$vu_active_key panel_cloud_page=0}
diff --git a/web/resources/views/venix/user/layout_plain_header.tpl b/web/resources/views/venix/user/layout_plain_header.tpl index 1ab7d5c2..895c81d2 100644 --- a/web/resources/views/venix/user/layout_plain_header.tpl +++ b/web/resources/views/venix/user/layout_plain_header.tpl @@ -1,5 +1,5 @@ - + {include file='user/layout_assets.tpl'} {assign var=vu_page_title value=$vu_title|default:''} @@ -27,3 +27,4 @@ +{include file='user/user_copy_bootstrap.tpl'} diff --git a/web/resources/views/venix/user/panel_sidebar.tpl b/web/resources/views/venix/user/panel_sidebar.tpl index 496a62d8..e3c9c192 100644 --- a/web/resources/views/venix/user/panel_sidebar.tpl +++ b/web/resources/views/venix/user/panel_sidebar.tpl @@ -1,71 +1,71 @@ {assign var=panel_cloud_mode value=$panel_cloud_page|default:0} {assign var=panel_active_key value=$panel_active|default:''} {assign var=panel_cloud_active_key value=$panel_cloud_active|default:''} -