feat(i18n): add localized content for quest map

This commit is contained in:
neilchen0812 committed 2026-09-22 01:22:25 +09:30
1 parent 4a43df9dd9
commit 10c8dd5f0e
5 files changed
+29 -5

No files matched your search

+6 -3
View File
@@ -1,10 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
import { ref, defineProps, onMounted } from 'vue' import { ref, defineProps, onMounted } from 'vue'
import MarkdownText from './MarkdownText.vue' import MarkdownText from './MarkdownText.vue'
import { trpc } from '../utils/trpc' import { trpc } from '../utils/trpc'
const { t } = useI18n()
const props = defineProps({ const props = defineProps({
questTitle: { questTitle: {
type: String, type: String,
@@ -36,7 +39,7 @@ const handleQuests = (id: string) => {
if (questUnlocked) { if (questUnlocked) {
router.push({ name: 'game', params: { questId: id } }) router.push({ name: 'game', params: { questId: id } })
} else { } else {
toast.warning('你還沒完成前一個關卡!') toast.warning(t('quest.locked'))
} }
} }
const handleColour = () => { const handleColour = () => {
@@ -61,7 +64,6 @@ onMounted(async () => {
<span class="close text-text content-between" @click="closeModal" <span class="close text-text content-between" @click="closeModal"
>&times;</span >&times;</span
> >
<h2 <h2
id="QuestTitle" id="QuestTitle"
class="text-2xl text-text mb-5 w-full inline-flex justify-center" class="text-2xl text-text mb-5 w-full inline-flex justify-center"
@@ -82,8 +84,9 @@ onMounted(async () => {
@click="handleQuests(questId)" @click="handleQuests(questId)"
:style="{ backgroundColor: questColor, color: questTextColor }" :style="{ backgroundColor: questColor, color: questTextColor }"
class="inline-flex justify-center rounded-lg text-base font-black py-3 mt-5 w-full text-lg" class="inline-flex justify-center rounded-lg text-base font-black py-3 mt-5 w-full text-lg"
>開始冒險</a
> >
{{ t('quest.start') }}
</a>
</div> </div>
</div> </div>
</template> </template>
+3 -1
View File
@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { ref, onMounted, watch, computed } from 'vue' import { ref, onMounted, watch, computed } from 'vue'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
import { DAG } from '../../../packages/utils' import { DAG } from '../../../packages/utils'
@@ -6,6 +7,7 @@ import { trpc } from '../utils/trpc'
import useUserProfile from '../store/userProfile' import useUserProfile from '../store/userProfile'
import QuestIntro from './QuestIntro.vue' import QuestIntro from './QuestIntro.vue'
const { t } = useI18n()
const store = useUserProfile() const store = useUserProfile()
const toast = useToast() const toast = useToast()
@@ -151,7 +153,7 @@ const edgeStyle = computed(() => {
class="p-10 absolute w-fit z-2 font-mono flex flax-wrap text-xl" class="p-10 absolute w-fit z-2 font-mono flex flax-wrap text-xl"
style="width: 30%; height: 6%; font-size: 3vh; color: #00ff00" style="width: 30%; height: 6%; font-size: 3vh; color: #00ff00"
> >
踏上你的Linux冒險之旅吧! {{ t('quest_map.intro') }}
</h1> </h1>
<svg <svg
:width="svgWidth" :width="svgWidth"
+8
View File
@@ -74,5 +74,13 @@
"sign_out": "Sign Out", "sign_out": "Sign Out",
"sign_out_failed": "Sign Out Failed", "sign_out_failed": "Sign Out Failed",
"load_user_profile_failed": "Failed to Load User Profile" "load_user_profile_failed": "Failed to Load User Profile"
},
"quest_map": {
"title": "Quest Map",
"intro": "Embark on your Linux adventure!"
},
"quest": {
"start": "Start Adventure",
"locked": "Quest not unlocked"
} }
} }
+8
View File
@@ -74,5 +74,13 @@
"sign_out": "登出", "sign_out": "登出",
"sign_out_failed": "登出失敗", "sign_out_failed": "登出失敗",
"load_user_profile_failed": "無法讀取使用者資料" "load_user_profile_failed": "無法讀取使用者資料"
},
"quest_map": {
"title": "關卡地圖",
"intro": "踏上你的Linux冒險之旅吧!"
},
"quest": {
"start": "開始冒險",
"locked": "關卡尚未解鎖"
} }
} }
+4 -1
View File
@@ -1,13 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from 'vue-i18n'
import QuestMap from '../components/QuestMap.vue' import QuestMap from '../components/QuestMap.vue'
import HeaderPart from '../components/header/HeaderPart.vue' import HeaderPart from '../components/header/HeaderPart.vue'
import GameHeaderComponents from '../components/header/GameHeaderComponents.vue' import GameHeaderComponents from '../components/header/GameHeaderComponents.vue'
const { t } = useI18n()
</script> </script>
<template> <template>
<div class="w-fit"> <div class="w-fit">
<HeaderPart <HeaderPart
title="關卡地圖" :title="t('quest_map.title')"
:headerComponent="GameHeaderComponents" :headerComponent="GameHeaderComponents"
class="z-50" class="z-50"
/> />