feat: i18n achievement UI labels and data layer title/description

This commit is contained in:
2026-06-10 16:36:24 +08:00
parent e51b5e234e
commit 2f9f9a4117
10 changed files with 66 additions and 7 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -24,6 +24,7 @@
"quitToMenu": "Back to Menu",
"pauseHint": "Esc = Resume",
"achievements": "Achievements",
"achievementUnlocked": "Achievement Unlocked",
"gallery": "Gallery",
"story": "Story Progress",
"startChapter": "Start",

View File

@@ -24,6 +24,7 @@
"quitToMenu": "メニューに戻る",
"pauseHint": "Esc = 再開",
"achievements": "実績",
"achievementUnlocked": "実績解除",
"gallery": "ギャラリー",
"story": "ストーリー進行",
"startChapter": "開始",

View File

@@ -24,6 +24,7 @@
"quitToMenu": "返回主菜单",
"pauseHint": "Esc = 继续",
"achievements": "成就",
"achievementUnlocked": "成就解锁",
"gallery": "画廊",
"story": "故事进度",
"startChapter": "开始",