fix: 에러 페이지 다국어 파일명 변경, 언어 name API 바로보도록 수정
This commit is contained in:
@@ -70,7 +70,7 @@ interface ErrorProps {
|
|||||||
// Configuration
|
// Configuration
|
||||||
const runtimeConfig = useRuntimeConfig()
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const multilingualFileName = 'STOVE_PUBTEMPLATE_common_error-message.json'
|
const multilingualFileName = 'STOVE_PUBTEMPLATE_homepage_brand_error.json'
|
||||||
|
|
||||||
// Multilingual
|
// Multilingual
|
||||||
const resultGetMultilingual = await useGetMultilingual({
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ interface ErrorProps {
|
|||||||
// Configuration
|
// Configuration
|
||||||
const runtimeConfig = useRuntimeConfig()
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const multilingualFileName = 'STOVE_PUBTEMPLATE_common_error-message.json'
|
const multilingualFileName = 'STOVE_PUBTEMPLATE_homepage_brand_error.json'
|
||||||
|
|
||||||
// Multilingual
|
// Multilingual
|
||||||
const resultGetMultilingual = await useGetMultilingual({
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="select-language" :class="{ 'language-changing': isChanging }">
|
<div
|
||||||
|
class="flex items-center justify-center relative w-[180px] text-left text-xs text-[#ccc] transition-opacity duration-300"
|
||||||
|
:class="{ 'opacity-50 pointer-events-none': isChanging }"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
:disabled="isChanging"
|
:disabled="isChanging"
|
||||||
class="flex items-center gap-2 px-3 py-2 rounded-lg text-[#CCCCCC] transition-all duration-300 w-[180px] bg-[#292929] border border-[#595959]"
|
class="flex items-center gap-2 px-3 py-2 rounded-lg text-[#CCCCCC] transition-all duration-300 w-[180px] bg-[#292929] border border-[#595959]"
|
||||||
@@ -78,15 +81,21 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
<div v-if="isDropdownOpen" class="dropdown-menu">
|
<div
|
||||||
|
v-if="isDropdownOpen"
|
||||||
|
class="absolute bottom-full mb-1 left-0 w-full bg-[#292929] border border-[#595959] rounded-lg p-2.5 text-xs text-[#ccc] z-[5]"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
v-for="localeItem in availableLanguages"
|
v-for="localeItem in availableLanguages"
|
||||||
:key="localeItem.code"
|
:key="localeItem.code"
|
||||||
class="dropdown-menu-item"
|
class="dropdown-menu-item"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="dropdown-menu-item-button"
|
class="flex items-center w-full h-10 gap-2 px-3 text-left bg-transparent border-none cursor-pointer transition-colors duration-200"
|
||||||
:class="{ current: localeItem.code === selectedLocale }"
|
:class="{
|
||||||
|
'text-[#fc4420] font-medium': localeItem.code === selectedLocale,
|
||||||
|
'text-[#ccc]': localeItem.code !== selectedLocale,
|
||||||
|
}"
|
||||||
@click="selectLanguage(localeItem.code)"
|
@click="selectLanguage(localeItem.code)"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@@ -96,6 +105,10 @@
|
|||||||
fill="none"
|
fill="none"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
class="transition-opacity duration-200"
|
class="transition-opacity duration-200"
|
||||||
|
:class="{
|
||||||
|
'opacity-100': localeItem.code === selectedLocale,
|
||||||
|
'opacity-0': localeItem.code !== selectedLocale,
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fill-rule="evenodd"
|
fill-rule="evenodd"
|
||||||
@@ -119,30 +132,29 @@ const gameDataStore = useGameDataStore()
|
|||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameData } = storeToRefs(gameDataStore)
|
||||||
// 사용 가능한 언어 목록
|
// 사용 가능한 언어 목록
|
||||||
const availableLanguages = computed(() => {
|
const availableLanguages = computed(() => {
|
||||||
return (
|
const langCodes = gameData.value?.lang_codes || []
|
||||||
gameData.value?.lang_codes?.map(localeCode => ({
|
const allLanguages =
|
||||||
code: localeCode,
|
gameData.value?.globals?.map((item: any) => ({
|
||||||
name: getLanguageName(localeCode),
|
code: item.lang_json?.code,
|
||||||
})) || [{ code: 'ko', name: '한국어' }]
|
name: item.lang_json?.name,
|
||||||
|
})) || []
|
||||||
|
|
||||||
|
// lang_codes에 포함된 언어만 필터링
|
||||||
|
const filteredLanguages = allLanguages.filter(lang =>
|
||||||
|
langCodes.includes(lang.code)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return filteredLanguages.length > 0
|
||||||
|
? filteredLanguages
|
||||||
|
: [{ code: 'ko', name: '한국어' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
// 언어 코드를 한국어 이름으로 변환하는 함수
|
// 언어 코드를 이름으로 변환하는 함수
|
||||||
const getLanguageName = (localeCode: string) => {
|
const getLanguageName = (localeCode: string) => {
|
||||||
const languageNames: Record<string, string> = {
|
const language = availableLanguages.value.find(
|
||||||
ko: '한국어',
|
lang => lang.code === localeCode
|
||||||
en: 'English',
|
)
|
||||||
ja: '日本語',
|
return language?.name || localeCode
|
||||||
'zh-cn': '简体中文',
|
|
||||||
'zh-tw': '繁體中文',
|
|
||||||
es: 'Español',
|
|
||||||
fr: 'Français',
|
|
||||||
de: 'Deutsch',
|
|
||||||
pt: 'Português',
|
|
||||||
th: 'ไทย',
|
|
||||||
it: 'Italiano',
|
|
||||||
}
|
|
||||||
return languageNames[localeCode] || localeCode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { locale, setLocale } = useI18n()
|
const { locale, setLocale } = useI18n()
|
||||||
@@ -220,17 +232,6 @@ watch(locale, newLocale => {
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.select-language {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
width: 180px;
|
|
||||||
text-align: left;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 페이지 전환 애니메이션 */
|
/* 페이지 전환 애니메이션 */
|
||||||
.page-enter-active,
|
.page-enter-active,
|
||||||
.page-leave-active {
|
.page-leave-active {
|
||||||
@@ -241,62 +242,4 @@ watch(locale, newLocale => {
|
|||||||
.page-leave-to {
|
.page-leave-to {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 언어 변경 시 전체 페이지 페이드 효과 */
|
|
||||||
.language-changing {
|
|
||||||
opacity: 0.5;
|
|
||||||
transition: opacity 0.3s ease;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 전체 페이지 전환 효과 */
|
|
||||||
body {
|
|
||||||
transition: opacity 0.5s ease-out;
|
|
||||||
}
|
|
||||||
.select-language select {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 0 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
.dropdown-menu {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 100%;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
background-color: #292929;
|
|
||||||
border: 1px solid #595959;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #ccc;
|
|
||||||
z-index: 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-menu-item-button {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
height: 40px;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 0 12px;
|
|
||||||
text-align: left;
|
|
||||||
background-color: transparent;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.2s ease;
|
|
||||||
}
|
|
||||||
.dropdown-menu-item-button svg {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
.dropdown-menu-item-button.current {
|
|
||||||
color: #fc4420;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
.dropdown-menu-item-button.current svg {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user