feat: inline bilingual choice text (textEn), lang-aware choice rendering

This commit is contained in:
2026-06-09 15:51:37 +08:00
parent daec24d69b
commit 8e7f77bc38
3 changed files with 24 additions and 4 deletions

View File

@@ -13,7 +13,12 @@ const emit = defineEmits<{
choose: [index: number]
}>()
const { t } = useI18n()
const { t, currentLang } = useI18n()
function choiceLabel(c: Choice): string {
if (currentLang.value === 'en' && (c as any).textEn) return (c as any).textEn
return c.text
}
const focusIndex = ref(0)
const btnRefs = ref<(HTMLButtonElement | null)[]>([])
@@ -75,7 +80,7 @@ function onKeydown(e: KeyboardEvent, index: number) {
@click="emit('choose', index)"
@keydown="onKeydown($event, index)"
>
{{ choice.text }}
{{ choiceLabel(choice) }}
</button>
</div>
</div>