chore: update i18n

This commit is contained in:
wonfen
2026-07-24 11:53:50 +08:00
parent 82c486923b
commit bce83d5c6f
123 changed files with 2178 additions and 277 deletions
+1 -1
View File
@@ -583,7 +583,7 @@ export function DnsViewer({ ref }: { ref?: Ref<DialogRef> }) {
setOpen(false)
showNotice.success('settings.modals.dns.messages.saved')
} catch (err) {
showNotice.error(err)
showNotice.error('settings.modals.dns.messages.configError', err)
}
})
+40 -10
View File
@@ -30,11 +30,26 @@ type MarkdownNode = {
}
const GITHUB_ALERTS = {
note: { label: 'Note', color: '#0969da' },
tip: { label: 'Tip', color: '#1a7f37' },
important: { label: 'Important', color: '#8250df' },
warning: { label: 'Warning', color: '#9a6700' },
caution: { label: 'Caution', color: '#cf222e' },
note: {
labelKey: 'settings.modals.update.alerts.note',
color: '#0969da',
},
tip: {
labelKey: 'settings.modals.update.alerts.tip',
color: '#1a7f37',
},
important: {
labelKey: 'settings.modals.update.alerts.important',
color: '#8250df',
},
warning: {
labelKey: 'settings.modals.update.alerts.warning',
color: '#9a6700',
},
caution: {
labelKey: 'settings.modals.update.alerts.caution',
color: '#cf222e',
},
} as const
type GitHubAlertType = keyof typeof GITHUB_ALERTS
@@ -76,7 +91,7 @@ const findFirstTextNode = (node: MarkdownNode): MarkdownNode | null => {
return null
}
const remarkGitHubAlerts = () => {
const remarkGitHubAlerts = (labels: Record<GitHubAlertType, string>) => {
const visit = (node: MarkdownNode) => {
for (const child of node.children ?? []) {
visit(child)
@@ -111,7 +126,7 @@ const remarkGitHubAlerts = () => {
children: [
{
type: 'text',
value: GITHUB_ALERTS[alertType].label,
value: labels[alertType],
},
],
})
@@ -144,12 +159,27 @@ export function UpdateViewer({ ref }: { ref?: Ref<DialogRef> }) {
close: () => setOpen(false),
}))
const githubAlertLabels = useMemo(
() =>
Object.fromEntries(
Object.entries(GITHUB_ALERTS).map(([type, alert]) => [
type,
t(alert.labelKey),
]),
) as Record<GitHubAlertType, string>,
[t],
)
const remarkGitHubAlertsPlugin = useMemo(
() => () => remarkGitHubAlerts(githubAlertLabels),
[githubAlertLabels],
)
const markdownContent = useMemo(() => {
if (!updateInfo?.body) {
return 'New Version is available'
return t('settings.modals.update.messages.available')
}
return updateInfo?.body
}, [updateInfo])
}, [t, updateInfo])
const breakChangeFlag = useMemo(() => {
if (!updateInfo?.body) {
@@ -382,7 +412,7 @@ export function UpdateViewer({ ref }: { ref?: Ref<DialogRef> }) {
{open && (
<Suspense fallback={<LinearProgress />}>
<LazyReactMarkdown
remarkPlugins={[remarkGitHubAlerts]}
remarkPlugins={[remarkGitHubAlertsPlugin]}
components={{
a: ({ ...props }) => {
const { children } = props
+11 -3
View File
@@ -74,9 +74,17 @@ export function WebUIViewer({ ref }: { ref?: Ref<DialogRef> }) {
let url = value.trim().replaceAll('%host', '127.0.0.1')
if (url.includes('%port') || url.includes('%secret')) {
if (!clashInfo) throw new Error('failed to get clash info')
if (!clashInfo) {
throw new Error(
t('settings.modals.webUI.errors.clashInfoUnavailable'),
)
}
if (!clashInfo.server?.includes(':')) {
throw new Error(`failed to parse the server "${clashInfo.server}"`)
throw new Error(
t('settings.modals.webUI.errors.invalidServer', {
server: clashInfo.server,
}),
)
}
const port = clashInfo.server
@@ -92,7 +100,7 @@ export function WebUIViewer({ ref }: { ref?: Ref<DialogRef> }) {
await openWebUrl(url)
} catch (e: any) {
showNotice.error(e)
showNotice.error('settings.modals.webUI.errors.openFailed', e)
}
})