refactor: i18n 수정
This commit is contained in:
@@ -1,29 +1,27 @@
|
|||||||
|
import fallback from './fallback/de'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['de'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,29 +1,27 @@
|
|||||||
|
import fallback from './fallback/en'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['en'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,29 +1,27 @@
|
|||||||
|
import fallback from './fallback/es'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['es'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,29 +1,27 @@
|
|||||||
|
import fallback from './fallback/fr'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['fr'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,29 +1,27 @@
|
|||||||
|
import fallback from './fallback/ja'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['ja'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
|
import fallback from './fallback/ko'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = (await commonFetch('GET', `${translationApi}`)) as any
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
if(import.meta.client) {
|
baseApiUrl: dataResourcesUrl,
|
||||||
console.log("🚀 ~ result:", result[locale])
|
fileName: multilingualFileName,
|
||||||
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['ko'] || {}
|
||||||
|
return localeData
|
||||||
}
|
}
|
||||||
return result[locale]
|
|
||||||
|
return {}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('[Exception] ko.defineI18nLocale: ', e)
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
return fallback
|
return fallback
|
||||||
|
|||||||
@@ -1,29 +1,27 @@
|
|||||||
|
import fallback from './fallback/pt'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['pt'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,29 +1,27 @@
|
|||||||
|
import fallback from './fallback/th'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['th'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,34 +1,27 @@
|
|||||||
|
import fallback from './fallback/zh-cn'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await useFetch(translationApi, {
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
method: 'GET',
|
baseApiUrl: dataResourcesUrl,
|
||||||
headers: {
|
fileName: multilingualFileName,
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['zh-cn'] || {}
|
||||||
|
return localeData
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
if(locale === 'zh-cn') {
|
|
||||||
locale = 'zh-CN'
|
|
||||||
}
|
|
||||||
|
|
||||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
|
||||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
|
||||||
|
|
||||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
|
||||||
const finalResult = { ...apiData }
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching translation data:', error)
|
|
||||||
// 에러 발생 시 common.json 데이터라도 반환
|
|
||||||
return commonData[locale] || {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
|
import fallback from './fallback/zh-tw'
|
||||||
|
|
||||||
export default defineI18nLocale(async (locale: string) => {
|
export default defineI18nLocale(async (locale: string) => {
|
||||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const config = useRuntimeConfig()
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
const rootPath = config.public.staticUrl
|
const multilingualFileName = 'test_common_template.json'
|
||||||
const runType = config.public.runType
|
|
||||||
|
|
||||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = (await commonFetch('GET', `${translationApi}`)) as any
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
if(import.meta.client) {
|
baseApiUrl: dataResourcesUrl,
|
||||||
console.log("🚀 ~ result:", result[locale])
|
fileName: multilingualFileName,
|
||||||
|
})
|
||||||
|
|
||||||
|
// multilingual 객체에서 현재 locale에 해당하는 데이터 추출
|
||||||
|
const multilingualData = resultGetMultilingual?.value?.multilingual
|
||||||
|
if (multilingualData && typeof multilingualData === 'object') {
|
||||||
|
// locale이 'ko'이므로 'ko' 키의 데이터를 반환
|
||||||
|
const localeData = multilingualData[locale] || multilingualData['zh-tw'] || {}
|
||||||
|
return localeData
|
||||||
}
|
}
|
||||||
return result[locale]
|
|
||||||
|
return {}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('[Exception] ko.defineI18nLocale: ', e)
|
console.error('[Exception] ko.defineI18nLocale: ', e)
|
||||||
return fallback
|
return fallback
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<footer id="footer" ref="footerRef" class="bg-black">
|
<footer id="footer" ref="footerRef" class="bg-black">
|
||||||
<div
|
<div
|
||||||
class="inner relative max-w-7xl mx-auto px-10 py-9 text-[12px] text-gray-400 md:px-4 md:py-9 md:text-[12px]"
|
class="inner relative max-w-7xl mx-auto px-5 md:px-10 py-4 text-[12px] text-gray-400 md:px-4 md:py-9 md:text-[12px]"
|
||||||
>
|
>
|
||||||
<div class="menu-area">
|
<div class="menu-area py-4 pb-4">
|
||||||
<ul class="flex items-center flex-wrap md:gap-6">
|
<ul class="flex items-center flex-wrap gap-x-6 gap-y-2">
|
||||||
<li
|
<li
|
||||||
v-for="(footerMenuItem, index) in footerLinks"
|
v-for="(footerMenuItem, index) in footerLinks"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="text-sm md:text-[11px] md:tracking-[-0.5px] relative flex items-center"
|
class="text-[15px] text-white/50 md:tracking-[-0.5px] relative flex items-center"
|
||||||
>
|
>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:to="footerMenuItem.url"
|
:to="footerMenuItem.url"
|
||||||
:target="footerMenuItem.target"
|
:target="footerMenuItem.target"
|
||||||
:class="[
|
:class="[
|
||||||
footerMenuItem.active === 'y' && 'text-[#e04600]',
|
footerMenuItem.active === 'y' && 'text-white/50',
|
||||||
index === 2 && 'text-[#fff]',
|
index === 2 && 'text-[#fff]',
|
||||||
'hover:text-gray-600 transition-colors',
|
'hover:text-gray-600 transition-colors',
|
||||||
]"
|
]"
|
||||||
@@ -23,13 +23,13 @@
|
|||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</li>
|
</li>
|
||||||
<li class="relative">
|
<li class="relative">
|
||||||
<button class="hover:text-gray-600 transition-colors" @click="toggleAgeRating">
|
<button class="text-[15px] text-white/50 hover:text-gray-600 transition-colors" @click="toggleAgeRating">
|
||||||
{{ footerAgeRating }}
|
{{ tm('Footer_AgeRating') }}
|
||||||
</button>
|
</button>
|
||||||
<div v-if="showAgeRating" class="game-rating-card absolute bottom-6 left-1/2 -translate-x-1/2 bg-[#383838] rounded-lg w-[340px] mx-auto z-10">
|
<div v-if="showAgeRating" class="game-rating-card absolute bottom-6 left-1 md:left-1/2 md:-translate-x-1/2 bg-[#383838] rounded-lg border border-white/30 w-[340px] mx-auto z-10">
|
||||||
<!-- 헤더 -->
|
<!-- 헤더 -->
|
||||||
<div class="px-6 py-4 rounded-t-lg flex justify-between items-center">
|
<div class="px-6 py-4 rounded-t-lg flex justify-between items-center">
|
||||||
<h3 class="text-white text-base">{{ footerAgeRating }}</h3>
|
<h3 class="text-white text-base">{{ tm('Footer_AgeRating') }}</h3>
|
||||||
<button class="text-white hover:text-gray-300 transition-colors" @click="toggleAgeRating">
|
<button class="text-white hover:text-gray-300 transition-colors" @click="toggleAgeRating">
|
||||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
||||||
@@ -81,23 +81,27 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="address-area mt-6">
|
<div class="address-area mt-4 hidden sm:block">
|
||||||
<address class="not-italic text-gray-500">
|
<address class="not-italic text-white/50">
|
||||||
<div class="row my-1.5 leading-5">
|
<div class="row my-1.5 leading-5">
|
||||||
<span
|
<span
|
||||||
v-dompurify-html="footerAddress"
|
v-dompurify-html="tm('Footer_Address')"
|
||||||
class="[&_a]:cursor-pointer [&_a]:text-blue-500 [&_a]:underline"
|
class="text-[13px] [&_a]:cursor-pointer [&_a]:text-white/50 [&_a]:underline"
|
||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
</address>
|
</address>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-6 md:mt-6">
|
<div class="language-area static md:absolute bottom-7 right-10 text-white mt-5 md:mt-0 md:bottom-5.5 md:right-4">
|
||||||
<div class="text-xs text-white/30">{{ footerCaution }}</div>
|
<BlocksLanguageSwitcher />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="copyright-area mt-6 text-gray-500 md:mt-4">
|
<div class="mt-6 md:mt-6 hidden sm:block">
|
||||||
<span>© Smilegate. All rights reserved</span>
|
<div v-dompurify-html="tm('Footer_caution')" class="text-xs text-white/30"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="copyright-area mt-6 text-[13px] text-white/50 md:mt-4">
|
||||||
|
<span>{{ tm('Footer_Copyright') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="logo-area flex mt-6 md:mt-6">
|
<div class="logo-area flex mt-6 md:mt-6">
|
||||||
@@ -107,7 +111,7 @@
|
|||||||
class="smilegate"
|
class="smilegate"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src="https://static-pubcomm.gate8.com/local/template/l9/common/logo_smilegate.png"
|
:src="getImageHost(`/local/template/l9/common/logo_smilegate.png`, { imageType: 'game' })"
|
||||||
alt="스마일게이트 로고"
|
alt="스마일게이트 로고"
|
||||||
class="w-auto h-auto"
|
class="w-auto h-auto"
|
||||||
/>
|
/>
|
||||||
@@ -119,21 +123,14 @@
|
|||||||
class="nx3 ml-2.5 md:ml-4"
|
class="nx3 ml-2.5 md:ml-4"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="`${staticUrl}${setDevCi.dev_ci_img_path}`"
|
:src="getImageHost(`${setDevCi.dev_ci_img_path}`, { imageType: 'game' })"
|
||||||
alt="CI"
|
alt="CI"
|
||||||
class="w-auto h-[24px]"
|
class="block w-auto h-[22px]"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
|
||||||
class="language-area absolute bottom-7 right-10 text-white md:bottom-5.5 md:right-4"
|
|
||||||
>
|
|
||||||
<BlocksLanguageSwitcher />
|
|
||||||
|
|
||||||
<!-- <SelectLanguage /> -->
|
|
||||||
<!-- <AtomsLanguageSwitcher /> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
@@ -141,20 +138,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { FooterMenuItem, FooterData, DevCiConfig } from '#layers/types/Common'
|
import type { FooterMenuItem, FooterData, DevCiConfig } from '#layers/types/Common'
|
||||||
|
|
||||||
const config = useRuntimeConfig()
|
// Configuration
|
||||||
const staticUrl = config.public.staticUrl
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const runType = config.public.runType
|
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
|
||||||
|
const multilingualFileName = 'test_common_template.json'
|
||||||
|
|
||||||
const translationApi = `${runType}/test/multilingual/test_common_template.json`
|
// Multilingual
|
||||||
|
const resultGetMultilingual = await useGetMultilingual({
|
||||||
const result = await useApiData({ baseApiUrl: staticUrl, url: translationApi })
|
baseApiUrl: dataResourcesUrl,
|
||||||
|
fileName: multilingualFileName,
|
||||||
const { tm } = useI18n({
|
})
|
||||||
useScope: 'local',
|
const { tm }: any = useI18n({
|
||||||
messages: result
|
useScope: 'local',
|
||||||
|
messages: Object(resultGetMultilingual?.value?.multilingual),
|
||||||
})
|
})
|
||||||
|
|
||||||
// const { tm } = useI18n()
|
|
||||||
|
|
||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameData } = storeToRefs(gameDataStore)
|
||||||
@@ -174,22 +171,16 @@ const setDevCi = ref<DevCiConfig>({
|
|||||||
///local/template/common/grades_age
|
///local/template/common/grades_age
|
||||||
const getGameRatingImage = computed((): string[] => {
|
const getGameRatingImage = computed((): string[] => {
|
||||||
const contentInfo = footerData.value.game_rating_info.rating_type.split(',')
|
const contentInfo = footerData.value.game_rating_info.rating_type.split(',')
|
||||||
// rating_type 12, 15, 18, 19 에 따라 이미지명을 가져오고 이미지를 반환
|
const ageTypeMap: Record<string, string> = {
|
||||||
return contentInfo.map(item => {
|
'12': 'Type12',
|
||||||
switch (item) {
|
'15': 'Type15',
|
||||||
case '12':
|
'19': 'Type19',
|
||||||
return getImageHost('/images/common/grades_age/Type12.svg', { imageType: 'common' })
|
'all': 'TypeAll',
|
||||||
case '15':
|
'e': 'TypeExempt'
|
||||||
return getImageHost('/images/common/grades_age/Type15.svg', { imageType: 'common' })
|
|
||||||
case '19':
|
|
||||||
return getImageHost('/images/common/grades_age/Type19.svg', { imageType: 'common' })
|
|
||||||
case 'all':
|
|
||||||
return getImageHost('/images/common/grades_age/TypeAll.svg', { imageType: 'common' })
|
|
||||||
case 'e':
|
|
||||||
return getImageHost('/images/common/grades_age/TypeExempt.svg', { imageType: 'common' })
|
|
||||||
default:
|
|
||||||
return getImageHost('/images/common/grades_age/TypeTest.svg', { imageType: 'common' })
|
|
||||||
}
|
}
|
||||||
|
return contentInfo.map(item => {
|
||||||
|
const type = ageTypeMap[item] || 'TypeTest'
|
||||||
|
return getImageHost(`/images/common/grades_age/${type}.svg`, { imageType: 'common' })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -197,24 +188,20 @@ const getContentInfoImage = computed((): string[] => {
|
|||||||
const contentInfo = footerData.value.game_rating_info.content_info.split(',')
|
const contentInfo = footerData.value.game_rating_info.content_info.split(',')
|
||||||
contentInfo.pop()
|
contentInfo.pop()
|
||||||
|
|
||||||
return contentInfo.map(item => {
|
const contentTypeMap: Record<string, string> = {
|
||||||
switch (item) {
|
'1': 'Type-sexual',
|
||||||
case '1':
|
'2': 'Type-fear',
|
||||||
return getImageHost('/images/common/grades_use/Type-sexual.svg', { imageType: 'common' })
|
'3': 'Type-inapposite',
|
||||||
case '2':
|
'4': 'Type-drug',
|
||||||
return getImageHost('/images/common/grades_use/Type-fear.svg', { imageType: 'common' })
|
'5': 'Type-crime',
|
||||||
case '3':
|
'6': 'Type-speculation',
|
||||||
return getImageHost('/images/common/grades_use/Type-inapposite.svg', { imageType: 'common' })
|
'7': 'Type-violence'
|
||||||
case '4':
|
|
||||||
return getImageHost('/images/common/grades_use/Type-drug.svg', { imageType: 'common' })
|
|
||||||
case '5':
|
|
||||||
return getImageHost('/images/common/grades_use/Type-crime.svg', { imageType: 'common' })
|
|
||||||
case '6':
|
|
||||||
return getImageHost('/images/common/grades_use/Type-speculation.svg', { imageType: 'common' })
|
|
||||||
case '7':
|
|
||||||
return getImageHost('/images/common/grades_use/Type-violence.svg', { imageType: 'common' })
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
return contentInfo.map(item => {
|
||||||
|
const type = contentTypeMap[item]
|
||||||
|
return type ? getImageHost(`/images/common/grades_use/${type}.svg`, { imageType: 'common' }) : ''
|
||||||
|
}).filter(Boolean)
|
||||||
})
|
})
|
||||||
|
|
||||||
const showAgeRating = ref<boolean>(false)
|
const showAgeRating = ref<boolean>(false)
|
||||||
@@ -222,37 +209,12 @@ const toggleAgeRating = (): void => {
|
|||||||
showAgeRating.value = !showAgeRating.value
|
showAgeRating.value = !showAgeRating.value
|
||||||
}
|
}
|
||||||
|
|
||||||
// 템플릿에서 사용할 다국어 텍스트들
|
|
||||||
const footerAgeRating = computed((): string => {
|
|
||||||
const text = (tm as any)('Footer_AgeRating')
|
|
||||||
return typeof text === 'string' ? text : ''
|
|
||||||
})
|
|
||||||
const footerAgeRatingInfo = computed((): string[] => {
|
const footerAgeRatingInfo = computed((): string[] => {
|
||||||
const info = (tm as any)('Footer_AgeRating_Info')
|
const info = (tm as any)('Footer_AgeRating_Info')
|
||||||
return Array.isArray(info) ? info : []
|
return Array.isArray(info) ? info : []
|
||||||
})
|
})
|
||||||
const footerAddress = computed((): string => {
|
|
||||||
const address = (tm as any)('Footer_Address')
|
|
||||||
return typeof address === 'string' ? address : ''
|
|
||||||
})
|
|
||||||
const footerCaution = computed((): string => {
|
|
||||||
const caution = (tm as any)('Footer_caution')
|
|
||||||
return typeof caution === 'string' ? caution : ''
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
/* 태국어 폰트 크기 조정 */
|
|
||||||
@media (max-width: 411px) {
|
|
||||||
:global(.lang-th) .menu-area li {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 321px) {
|
|
||||||
:global(.lang-th) .menu-area li {
|
|
||||||
font-size: 9px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user