mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 09:57:47 +08:00
fix(frontend): complete i18n coverage and responsive layouts
This commit is contained in:
@@ -533,6 +533,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getI18nLocale } from '@/i18n'
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import {
|
||||
X,
|
||||
@@ -760,7 +761,7 @@ function handleClose() {
|
||||
function formatDate(dateStr: string): string {
|
||||
if (!dateStr) return '-'
|
||||
const date = new Date(dateStr)
|
||||
return date.toLocaleDateString('zh-CN', {
|
||||
return date.toLocaleDateString(getI18nLocale(), {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
|
||||
@@ -940,7 +940,7 @@ import {
|
||||
} from 'lucide-vue-next'
|
||||
import { parseApiError } from '@/utils/errorParser'
|
||||
import { useEscapeKey } from '@/composables/useEscapeKey'
|
||||
import { useI18n } from '@/i18n'
|
||||
import { getI18nLocale, useI18n } from '@/i18n'
|
||||
import Button from '@/components/ui/button.vue'
|
||||
import Card from '@/components/ui/card.vue'
|
||||
import { useToast } from '@/composables/useToast'
|
||||
@@ -2476,7 +2476,7 @@ function isKiroBannedKey(key: EndpointAPIKey): boolean {
|
||||
function formatBanTimestamp(timestamp: number | undefined): string {
|
||||
if (!timestamp) return ''
|
||||
const date = new Date(timestamp * 1000)
|
||||
return date.toLocaleString('zh-CN', {
|
||||
return date.toLocaleString(getI18nLocale(), {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div class="space-y-1.5">
|
||||
<Label>{{ legacyT('提供商类型') }}</Label>
|
||||
<Select
|
||||
@@ -130,7 +130,7 @@
|
||||
</h3>
|
||||
|
||||
<!-- 超时配置 -->
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div class="space-y-1.5">
|
||||
<Label>
|
||||
{{ legacyT('流式首字节超时') }}
|
||||
@@ -164,11 +164,11 @@
|
||||
</div>
|
||||
|
||||
<!-- 提供商内转移限制 -->
|
||||
<div class="grid grid-cols-2 gap-2 sm:gap-4">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div class="min-w-0 space-y-1.5">
|
||||
<Label
|
||||
for="max-transfer-count"
|
||||
class="whitespace-nowrap text-xs sm:text-sm"
|
||||
class="text-xs sm:text-sm"
|
||||
>
|
||||
{{ legacyT('最大转移次数') }}
|
||||
</Label>
|
||||
@@ -185,7 +185,7 @@
|
||||
<div class="min-w-0 space-y-1.5">
|
||||
<Label
|
||||
for="max-transfer-timeout-seconds"
|
||||
class="whitespace-nowrap text-xs sm:text-sm"
|
||||
class="text-xs sm:text-sm"
|
||||
>
|
||||
{{ legacyT('最大转移超时') }}
|
||||
<span class="text-xs text-muted-foreground">{{ legacyT('(秒)') }}</span>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getI18nLocale } from '@/i18n'
|
||||
|
||||
export type HealthBadgeVariant =
|
||||
| 'default'
|
||||
| 'secondary'
|
||||
@@ -127,7 +129,7 @@ export function formatMs(value?: number | null) {
|
||||
}
|
||||
|
||||
function formatDurationNumber(value: number) {
|
||||
return new Intl.NumberFormat('zh-CN', {
|
||||
return new Intl.NumberFormat(getI18nLocale(), {
|
||||
maximumFractionDigits: Math.abs(value) < 10 ? 2 : 1
|
||||
}).format(value)
|
||||
}
|
||||
@@ -144,7 +146,7 @@ export function formatAvailability(item: HealthMonitorAvailability) {
|
||||
|
||||
export function formatTps(value?: number | null) {
|
||||
if (typeof value !== 'number' || Number.isNaN(value)) return '-'
|
||||
return `${new Intl.NumberFormat('zh-CN', {
|
||||
return `${new Intl.NumberFormat(getI18nLocale(), {
|
||||
maximumFractionDigits: value < 10 ? 2 : value < 100 ? 1 : 0
|
||||
}).format(value)} tps`
|
||||
}
|
||||
@@ -202,7 +204,7 @@ function formatTimelineRequestBreakdown(
|
||||
|
||||
function formatTimelineCount(value?: number | null) {
|
||||
if (typeof value !== 'number' || Number.isNaN(value)) return '-'
|
||||
return `${new Intl.NumberFormat('zh-CN').format(value)} 次`
|
||||
return `${new Intl.NumberFormat(getI18nLocale()).format(value)} 次`
|
||||
}
|
||||
|
||||
function formatTimelineMetricAvailability(metrics?: HealthTimelineTooltipMetrics | null) {
|
||||
@@ -213,7 +215,7 @@ function formatTimelineMetricAvailability(metrics?: HealthTimelineTooltipMetrics
|
||||
}
|
||||
|
||||
export function formatCompactNumber(value: number) {
|
||||
return new Intl.NumberFormat('zh-CN', {
|
||||
return new Intl.NumberFormat(getI18nLocale(), {
|
||||
notation: 'compact',
|
||||
maximumFractionDigits: 1
|
||||
}).format(value)
|
||||
@@ -223,7 +225,7 @@ export function formatTimestamp(timestamp?: string | null) {
|
||||
if (!timestamp) return '未知时间'
|
||||
const date = new Date(timestamp)
|
||||
if (Number.isNaN(date.getTime())) return '未知时间'
|
||||
return date.toLocaleString('zh-CN', {
|
||||
return date.toLocaleString(getI18nLocale(), {
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
|
||||
@@ -544,6 +544,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getI18nLocale } from '@/i18n'
|
||||
import { ref, watch, computed, onBeforeUnmount } from 'vue'
|
||||
import { isAxiosError } from 'axios'
|
||||
import Card from '@/components/ui/card.vue'
|
||||
@@ -2294,7 +2295,7 @@ const resolveAttemptTimeRange = (attempt: CandidateRecord | null | undefined): A
|
||||
// 格式化时间(详细)
|
||||
const formatTime = (dateStr: string) => {
|
||||
const date = new Date(dateStr)
|
||||
const timeStr = date.toLocaleTimeString('zh-CN', {
|
||||
const timeStr = date.toLocaleTimeString(getI18nLocale(), {
|
||||
hour12: false,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
|
||||
@@ -873,6 +873,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getI18nLocale } from '@/i18n'
|
||||
import { ref, watch, computed, onMounted, onBeforeUnmount } from 'vue'
|
||||
import Button from '@/components/ui/button.vue'
|
||||
import { useEscapeKey } from '@/composables/useEscapeKey'
|
||||
@@ -2848,7 +2849,7 @@ onBeforeUnmount(() => {
|
||||
function formatDateTime(dateStr: string | null | undefined): string {
|
||||
if (!dateStr) return 'N/A'
|
||||
const date = new Date(dateStr)
|
||||
return date.toLocaleString('zh-CN', {
|
||||
return date.toLocaleString(getI18nLocale(), {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
|
||||
@@ -509,6 +509,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getI18nLocale } from '@/i18n'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import {
|
||||
Badge,
|
||||
@@ -1027,7 +1028,7 @@ async function submitCompleteRefund() {
|
||||
|
||||
function formatDateTime(value: string | null | undefined) {
|
||||
if (!value) return '-'
|
||||
return new Date(value).toLocaleString('zh-CN', {
|
||||
return new Date(value).toLocaleString(getI18nLocale(), {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
|
||||
Reference in New Issue
Block a user