feat: i18n achievement UI labels and data layer title/description
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { AchievementDef } from '@engine/types'
|
||||
import { useI18n } from '@/composables/useI18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
defineProps<{
|
||||
definitions: AchievementDef[]
|
||||
@@ -14,7 +17,7 @@ const emit = defineEmits<{
|
||||
<template>
|
||||
<div class="ach-overlay" @click.self="emit('close')" @keydown.escape="emit('close')">
|
||||
<div class="ach-panel">
|
||||
<h2 class="ach-title">成就</h2>
|
||||
<h2 class="ach-title">{{ t('ui.achievements') }}</h2>
|
||||
|
||||
<div class="ach-list">
|
||||
<div
|
||||
@@ -29,16 +32,16 @@ const emit = defineEmits<{
|
||||
</div>
|
||||
<div class="ach-body">
|
||||
<div class="ach-title-text">
|
||||
{{ !unlockedIds.has(ach.id) && ach.hidden ? '???' : ach.title }}
|
||||
{{ !unlockedIds.has(ach.id) && ach.hidden ? '???' : t(ach.titleKey || ach.title) }}
|
||||
</div>
|
||||
<div class="ach-desc-text">
|
||||
{{ !unlockedIds.has(ach.id) && ach.hidden ? '' : ach.description }}
|
||||
{{ !unlockedIds.has(ach.id) && ach.hidden ? '' : t(ach.descKey || ach.description) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="ach-close" @click="emit('close')">关闭</button>
|
||||
<button class="ach-close" @click="emit('close')">{{ t('ui.close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, watch, ref } from 'vue'
|
||||
import type { AchievementDef } from '@engine/types'
|
||||
import { useI18n } from '@/composables/useI18n'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const props = defineProps<{
|
||||
achievementId: string
|
||||
@@ -32,9 +35,9 @@ watch(() => props.achievementId, (id) => {
|
||||
<span v-else class="toast-star">⭐</span>
|
||||
</div>
|
||||
<div class="toast-body">
|
||||
<div class="toast-label">成就解锁</div>
|
||||
<div class="toast-title">{{ def.title }}</div>
|
||||
<div class="toast-desc">{{ def.description }}</div>
|
||||
<div class="toast-label">{{ t('ui.achievementUnlocked') }}</div>
|
||||
<div class="toast-title">{{ def ? t(def.titleKey || def.title) : '' }}</div>
|
||||
<div class="toast-desc">{{ def ? t(def.descKey || def.description) : '' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user