fix(frontend): localize stray hardcoded UI strings

Move the last few user-visible hardcoded strings into vue-i18n:

- AppHeader: "Toggle Menu" / "User Menu" aria-labels (screen readers
  read these in English regardless of locale)
- CustomPageView: "Page not found" error body
- PaymentProviderDialog: display-name example placeholder hardcoded in
  Chinese for all locales

Adds common.toggleMenu / common.userMenu / common.pageNotFound and
admin.settings.payment.customMethodDisplayNamePlaceholder to both zh
and en locales, and registers the new placeholder key in the
PaymentProviderDialog spec's i18n mock.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Astrenix
2026-07-19 02:55:50 +08:00
co-authored by Claude Fable 5
parent d4b9797ff7
commit 3401a971a8
8 changed files with 13 additions and 4 deletions
+2 -2
View File
@@ -6,7 +6,7 @@
<button
@click="toggleMobileSidebar"
class="btn-ghost btn-icon lg:hidden"
aria-label="Toggle Menu"
:aria-label="t('common.toggleMenu')"
>
<Icon name="menu" size="md" />
</button>
@@ -96,7 +96,7 @@
<button
@click="toggleDropdown"
class="flex items-center gap-2 rounded-xl p-1.5 transition-colors hover:bg-gray-100 dark:hover:bg-dark-800"
aria-label="User Menu"
:aria-label="t('common.userMenu')"
>
<div class="flex h-8 w-8 items-center justify-center overflow-hidden rounded-xl bg-gradient-to-br from-primary-500 to-primary-600 text-sm font-medium text-white shadow-sm">
<img
@@ -100,7 +100,7 @@
</div>
<div>
<label class="text-xs text-gray-500 dark:text-gray-400">{{ t('admin.settings.payment.customMethodDisplayName') }}</label>
<input v-model="method.displayName" type="text" class="input mt-0.5" placeholder="信用卡" />
<input v-model="method.displayName" type="text" class="input mt-0.5" :placeholder="t('admin.settings.payment.customMethodDisplayNamePlaceholder')" />
</div>
<button
type="button"
@@ -13,6 +13,7 @@ const messages: Record<string, string> = {
'admin.settings.payment.customMethodType': 'Payment type',
'admin.settings.payment.customMethodUpstreamType': 'Upstream type',
'admin.settings.payment.customMethodDisplayName': 'Display name',
'admin.settings.payment.customMethodDisplayNamePlaceholder': '信用卡',
'admin.settings.payment.paymentGuideTrigger': 'View payment guide',
'admin.settings.payment.alipayGuideSummary': 'Desktop prefers QR precreate and falls back to cashier; mobile prefers WAP checkout.',
'admin.settings.payment.wxpayGuideSummary': 'Desktop prefers Native QR; mobile routes to JSAPI or H5 based on browser context.',
@@ -642,6 +642,7 @@ export default {
customMethodType: 'Payment type',
customMethodUpstreamType: 'Upstream type',
customMethodDisplayName: 'Display name',
customMethodDisplayNamePlaceholder: 'e.g. Credit card',
stripeWebhookHint: 'Configure the following URL as a Webhook endpoint in Stripe Dashboard:',
stripeWebhookApiVersionHint: 'Set this Webhook endpoint API version to match the integrated Stripe SDK. Recommended: {version}. A mismatch can cause webhook parsing errors.',
airwallexWebhookHint: 'Configure the following URL as a Webhook endpoint in Airwallex. Select at least Payment Intent -> Succeeded (payment_intent.succeeded), preferably also Payment Intent -> Cancelled (payment_intent.cancelled). Use the account default or latest stable API version.',
+3
View File
@@ -44,6 +44,9 @@ export default {
inactive: 'Inactive',
more: 'More',
close: 'Close',
toggleMenu: 'Toggle menu',
userMenu: 'User menu',
pageNotFound: 'Page not found',
enabled: 'Enabled',
disabled: 'Disabled',
total: 'Total',
@@ -637,6 +637,7 @@ export default {
customMethodType: '支付方式',
customMethodUpstreamType: '上游 type',
customMethodDisplayName: '显示名称',
customMethodDisplayNamePlaceholder: '如:信用卡',
stripeWebhookHint: '请在 Stripe Dashboard 中将以下地址配置为 Webhook 端点:',
stripeWebhookApiVersionHint: 'Webhook 端点的 API 版本请与当前集成的 Stripe SDK 对齐,建议选择 {version};版本不一致可能导致回调事件解析失败。',
airwallexWebhookHint: '请在 Airwallex 后台将以下地址配置为 Webhook 端点;事件至少选择 Payment Intent -> Succeeded(payment_intent.succeeded),建议同时选择 Payment Intent -> Cancelled(payment_intent.cancelled);API version 选择账户默认或最新稳定版本。',
+3
View File
@@ -44,6 +44,9 @@ export default {
inactive: '禁用',
more: '更多',
close: '关闭',
toggleMenu: '切换菜单',
userMenu: '用户菜单',
pageNotFound: '页面不存在',
enabled: '已启用',
disabled: '已禁用',
total: '总计',
+1 -1
View File
@@ -230,7 +230,7 @@ async function fetchAndRenderMarkdown(slug: string) {
headers: authStore.token ? { Authorization: `Bearer ${authStore.token}` } : {},
})
if (!resp.ok) {
renderedHtml.value = '<p class="text-red-500">Page not found</p>'
renderedHtml.value = `<p class="text-red-500">${t('common.pageNotFound')}</p>`
return
}
let raw = await resp.text()