feat(admin): add zh/en i18n to the config console

Introduce a lightweight useI18n composable (zh default, auto-detect via
navigator.language, manual toggle persisted to localStorage) with full
zh/en dictionaries, and wire translation keys through the console UI.
This commit is contained in:
RhenCloud 2026-08-02 08:40:01 +08:00
parent d3c1349d00
commit 9e0f21c538
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
3 changed files with 280 additions and 25 deletions

View file

@ -1,12 +1,12 @@
<template>
<div>
<div class="log-toolbar">
<span class="kpi-label">LAST {{ logs.length }} SENDS</span>
<button class="btn btn-ghost btn-sm" :disabled="loading" @click="refresh"> Refresh</button>
<span class="kpi-label">{{ t("logs.lastSends", { n: logs.length }) }}</span>
<button class="btn btn-ghost btn-sm" :disabled="loading" @click="refresh">{{ t("logs.refresh") }}</button>
</div>
<p v-if="error" class="err">{{ error }}</p>
<p v-else-if="!loading && !logs.length" class="empty-log">No send records yet trigger a webhook to see results.</p>
<p v-else-if="!loading && !logs.length" class="empty-log">{{ t("logs.empty") }}</p>
<div class="log-list">
<article v-for="l in logs" :key="l.ts + l.routeId" class="log-entry" :class="{ fail: !l.ok }">
@ -17,8 +17,8 @@
<span class="log-time">{{ fmtTime(l.ts) }}</span>
</div>
<div class="log-meta">
<span v-if="l.repo"><b>REPO</b><code>{{ l.repo }}</code></span>
<span><b>TARGET</b><code>{{ l.target }}</code></span>
<span v-if="l.repo"><b>{{ t("logs.repo") }}</b><code>{{ l.repo }}</code></span>
<span><b>{{ t("logs.target") }}</b><code>{{ l.target }}</code></span>
</div>
<div v-if="!l.ok && l.error" class="log-error">{{ l.error }}</div>
</article>
@ -29,6 +29,8 @@
<script setup lang="ts">
import type { SendRecord } from "~/types";
const { t } = useI18n();
const props = defineProps<{ logs: SendRecord[]; loading: boolean }>();
const emit = defineEmits<{ (e: "refresh"): void }>();