refactor(frontend): modularize i18n architecture

This commit is contained in:
elky
2026-06-30 17:01:39 +08:00
parent bf29129a4b
commit 9f138d09e6
118 changed files with 11940 additions and 5368 deletions
+10 -4
View File
@@ -14,7 +14,7 @@
/>
<div class="flex-1 min-w-0">
<h3 class="text-lg font-semibold text-foreground leading-tight">
{{ title }}
{{ displayTitle }}
</h3>
</div>
</div>
@@ -44,7 +44,7 @@
class="h-10 px-5"
@click="handleCancel"
>
{{ cancelText }}
{{ displayCancelText }}
</Button>
<!-- 确认按钮 -->
@@ -58,7 +58,7 @@
v-if="loading"
class="animate-spin h-4 w-4 mr-2"
/>
{{ confirmText }}
{{ displayConfirmText }}
</Button>
</template>
</Dialog>
@@ -69,6 +69,7 @@ import { computed } from 'vue'
import { Dialog } from '@/components/ui'
import Button from '@/components/ui/button.vue'
import { AlertTriangle, AlertCircle, Info, Trash2, HelpCircle, Loader2 } from 'lucide-vue-next'
import { useI18n } from '@/i18n'
export type AlertType = 'danger' | 'destructive' | 'warning' | 'info' | 'question'
@@ -96,10 +97,15 @@ const props = withDefaults(defineProps<Props>(), {
})
const emit = defineEmits<Emits>()
const { legacyT } = useI18n()
const displayTitle = computed(() => legacyT(props.title))
const displayConfirmText = computed(() => legacyT(props.confirmText))
const displayCancelText = computed(() => legacyT(props.cancelText))
// 解析描述文本为多行
const descriptionLines = computed(() => {
return props.description.split('\n').filter(line => line.trim())
return legacyT(props.description).split('\n').filter(line => line.trim())
})
function escapeHtml(raw: string): string {