feat: inline bilingual choice text (textEn), lang-aware choice rendering
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user