Merge branch 'feature/20251001-gil' into feature/20250910-all
This commit is contained in:
@@ -1,49 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const baseType = runtimeConfig.public.baseType
|
||||
const translationItems = runtimeConfig.public.translationItems
|
||||
const translationItemsArr = translationItems.split(',')
|
||||
const staticUrl = runtimeConfig.public.staticUrl
|
||||
const translationApi = translationItemsArr.map((item: string): string => {
|
||||
return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
})
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// API 데이터 가져오기
|
||||
const fetchDataPromises = translationApi.map(apiUrl => {
|
||||
return useFetch(apiUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
})
|
||||
})
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
const fetchResults = await Promise.all(fetchDataPromises)
|
||||
|
||||
// 각 결과에서 locale에 맞는 데이터를 추출
|
||||
const apiData = fetchResults.map(result => {
|
||||
return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// apiData를 이용해 자동으로 병합
|
||||
const mergedResult = apiData.reduce((acc, data) => {
|
||||
return { ...acc, ...data }
|
||||
}, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,57 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
// const config = useRuntimeConfig()
|
||||
// const baseType = config.public.baseType
|
||||
// const translationItems = config.public.translationItems
|
||||
// const translationItemsArr = translationItems.split(',')
|
||||
// const staticUrl = config.public.staticUrl
|
||||
// const translationPaths = translationItemsArr.map((item) => {
|
||||
// 경로를 생성하며 ~/assets/data 경로로 설정
|
||||
// return `~/assets/data/${item}.json`
|
||||
// })
|
||||
// const resources = await Promise.all(translationPaths.map((path) => import(`${path}`)))
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// console.log('translationLocal ~ translationLocal:', translationLocal)
|
||||
// const translationApi = translationItemsArr.map((item: string): string => {
|
||||
// return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
// })
|
||||
|
||||
// // API 데이터 가져오기
|
||||
// const fetchDataPromises = translationApi.map((apiUrl) => {
|
||||
// return useFetch(apiUrl, {
|
||||
// method: 'GET',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8'
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
// const fetchResults = await Promise.all(fetchDataPromises)
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// // 각 결과에서 locale에 맞는 데이터를 추출
|
||||
// const apiData = fetchResults.map((result) => {
|
||||
// return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
// })
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// // apiData를 이용해 자동으로 병합
|
||||
// const mergedResult = apiData.reduce((acc, data) => {
|
||||
// return { ...acc, ...data }
|
||||
// }, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
// const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
const finalResult = { ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,49 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const baseType = runtimeConfig.public.baseType
|
||||
const translationItems = runtimeConfig.public.translationItems
|
||||
const translationItemsArr = translationItems.split(',')
|
||||
const staticUrl = runtimeConfig.public.staticUrl
|
||||
const translationApi = translationItemsArr.map((item: string): string => {
|
||||
return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
})
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// API 데이터 가져오기
|
||||
const fetchDataPromises = translationApi.map(apiUrl => {
|
||||
return useFetch(apiUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
})
|
||||
})
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
const fetchResults = await Promise.all(fetchDataPromises)
|
||||
|
||||
// 각 결과에서 locale에 맞는 데이터를 추출
|
||||
const apiData = fetchResults.map(result => {
|
||||
return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// apiData를 이용해 자동으로 병합
|
||||
const mergedResult = apiData.reduce((acc, data) => {
|
||||
return { ...acc, ...data }
|
||||
}, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,49 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const baseType = runtimeConfig.public.baseType
|
||||
const translationItems = runtimeConfig.public.translationItems
|
||||
const translationItemsArr = translationItems.split(',')
|
||||
const staticUrl = runtimeConfig.public.staticUrl
|
||||
const translationApi = translationItemsArr.map((item: string): string => {
|
||||
return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
})
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// API 데이터 가져오기
|
||||
const fetchDataPromises = translationApi.map(apiUrl => {
|
||||
return useFetch(apiUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
})
|
||||
})
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
const fetchResults = await Promise.all(fetchDataPromises)
|
||||
|
||||
// 각 결과에서 locale에 맞는 데이터를 추출
|
||||
const apiData = fetchResults.map(result => {
|
||||
return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// apiData를 이용해 자동으로 병합
|
||||
const mergedResult = apiData.reduce((acc, data) => {
|
||||
return { ...acc, ...data }
|
||||
}, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,57 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
// const config = useRuntimeConfig()
|
||||
// const baseType = config.public.baseType
|
||||
// const translationItems = config.public.translationItems
|
||||
// const translationItemsArr = translationItems.split(',')
|
||||
// const staticUrl = config.public.staticUrl
|
||||
// const translationPaths = translationItemsArr.map((item) => {
|
||||
// 경로를 생성하며 ~/assets/data 경로로 설정
|
||||
// return `~/assets/data/${item}.json`
|
||||
// })
|
||||
// const resources = await Promise.all(translationPaths.map((path) => import(`${path}`)))
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// console.log('translationLocal ~ translationLocal:', translationLocal)
|
||||
// const translationApi = translationItemsArr.map((item: string): string => {
|
||||
// return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
// })
|
||||
|
||||
// // API 데이터 가져오기
|
||||
// const fetchDataPromises = translationApi.map((apiUrl) => {
|
||||
// return useFetch(apiUrl, {
|
||||
// method: 'GET',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8'
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
// const fetchResults = await Promise.all(fetchDataPromises)
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// // 각 결과에서 locale에 맞는 데이터를 추출
|
||||
// const apiData = fetchResults.map((result) => {
|
||||
// return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
// })
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// // apiData를 이용해 자동으로 병합
|
||||
// const mergedResult = apiData.reduce((acc, data) => {
|
||||
// return { ...acc, ...data }
|
||||
// }, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
// const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
const finalResult = { ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,57 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
// const config = useRuntimeConfig()
|
||||
// const baseType = config.public.baseType
|
||||
// const translationItems = config.public.translationItems
|
||||
// const translationItemsArr = translationItems.split(',')
|
||||
// const staticUrl = config.public.staticUrl
|
||||
// const translationPaths = translationItemsArr.map((item) => {
|
||||
// 경로를 생성하며 ~/assets/data 경로로 설정
|
||||
// return `~/assets/data/${item}.json`
|
||||
// })
|
||||
// const resources = await Promise.all(translationPaths.map((path) => import(`${path}`)))
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// console.log('translationLocal ~ translationLocal:', translationLocal)
|
||||
// const translationApi = translationItemsArr.map((item: string): string => {
|
||||
// return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
// })
|
||||
|
||||
// // API 데이터 가져오기
|
||||
// const fetchDataPromises = translationApi.map((apiUrl) => {
|
||||
// return useFetch(apiUrl, {
|
||||
// method: 'GET',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8'
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
// const fetchResults = await Promise.all(fetchDataPromises)
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// // 각 결과에서 locale에 맞는 데이터를 추출
|
||||
// const apiData = fetchResults.map((result) => {
|
||||
// return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
// })
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// // apiData를 이용해 자동으로 병합
|
||||
// const mergedResult = apiData.reduce((acc, data) => {
|
||||
// return { ...acc, ...data }
|
||||
// }, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
// const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
const finalResult = { ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,49 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const baseType = runtimeConfig.public.baseType
|
||||
const translationItems = runtimeConfig.public.translationItems
|
||||
const translationItemsArr = translationItems.split(',')
|
||||
const staticUrl = runtimeConfig.public.staticUrl
|
||||
const translationApi = translationItemsArr.map((item: string): string => {
|
||||
return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
})
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// API 데이터 가져오기
|
||||
const fetchDataPromises = translationApi.map(apiUrl => {
|
||||
return useFetch(apiUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
})
|
||||
})
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
const fetchResults = await Promise.all(fetchDataPromises)
|
||||
|
||||
// 각 결과에서 locale에 맞는 데이터를 추출
|
||||
const apiData = fetchResults.map(result => {
|
||||
return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// apiData를 이용해 자동으로 병합
|
||||
const mergedResult = apiData.reduce((acc, data) => {
|
||||
return { ...acc, ...data }
|
||||
}, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,49 +1,24 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const baseType = config.public.baseType
|
||||
const translationItems = config.public.translationItems
|
||||
const translationItemsArr = translationItems.split(',')
|
||||
const staticUrl = config.public.staticUrl
|
||||
const translationApi = translationItemsArr.map((item: string): string => {
|
||||
return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
})
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// API 데이터 가져오기
|
||||
const fetchDataPromises = translationApi.map((apiUrl) => {
|
||||
return useFetch(apiUrl, {
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
try {
|
||||
const fetchResults = await Promise.all(fetchDataPromises)
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// 각 결과에서 locale에 맞는 데이터를 추출
|
||||
const apiData = fetchResults.map((result) => {
|
||||
return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
})
|
||||
|
||||
// apiData를 이용해 자동으로 병합
|
||||
const mergedResult = apiData.reduce((acc, data) => {
|
||||
return { ...acc, ...data }
|
||||
}, {})
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,57 +1,29 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
// const config = useRuntimeConfig()
|
||||
// const baseType = config.public.baseType
|
||||
// const translationItems = config.public.translationItems
|
||||
// const translationItemsArr = translationItems.split(',')
|
||||
// const staticUrl = config.public.staticUrl
|
||||
// const translationPaths = translationItemsArr.map((item) => {
|
||||
// 경로를 생성하며 ~/assets/data 경로로 설정
|
||||
// return `~/assets/data/${item}.json`
|
||||
// })
|
||||
// const resources = await Promise.all(translationPaths.map((path) => import(`${path}`)))
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// console.log('translationLocal ~ translationLocal:', translationLocal)
|
||||
// const translationApi = translationItemsArr.map((item: string): string => {
|
||||
// return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
// })
|
||||
|
||||
// // API 데이터 가져오기
|
||||
// const fetchDataPromises = translationApi.map((apiUrl) => {
|
||||
// return useFetch(apiUrl, {
|
||||
// method: 'GET',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8'
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
// const fetchResults = await Promise.all(fetchDataPromises)
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// // 각 결과에서 locale에 맞는 데이터를 추출
|
||||
// const apiData = fetchResults.map((result) => {
|
||||
// return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
// })
|
||||
|
||||
// // apiData를 이용해 자동으로 병합
|
||||
// const mergedResult = apiData.reduce((acc, data) => {
|
||||
// return { ...acc, ...data }
|
||||
// }, {})
|
||||
if(locale === 'zh-cn') {
|
||||
locale = 'zh-CN'
|
||||
}
|
||||
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
// const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
const finalResult = { ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,57 +1,29 @@
|
||||
// import { TRANSLATION_ITEMS } from '../i18n.config'
|
||||
// common.json 파일을 직접 import
|
||||
// @ts-ignore
|
||||
import commonData from '../../layers/assets/data/common.json'
|
||||
|
||||
export default defineI18nLocale(async (locale: string) => {
|
||||
// const config = useRuntimeConfig()
|
||||
// const baseType = config.public.baseType
|
||||
// const translationItems = config.public.translationItems
|
||||
// const translationItemsArr = translationItems.split(',')
|
||||
// const staticUrl = config.public.staticUrl
|
||||
// const translationPaths = translationItemsArr.map((item) => {
|
||||
// 경로를 생성하며 ~/assets/data 경로로 설정
|
||||
// return `~/assets/data/${item}.json`
|
||||
// })
|
||||
// const resources = await Promise.all(translationPaths.map((path) => import(`${path}`)))
|
||||
//https://static-pubcomm.gate8.com/dev/test/multilingual/test_common_template.json?20251021185116
|
||||
const config = useRuntimeConfig()
|
||||
const rootPath = config.public.staticUrl
|
||||
const runType = config.public.runType
|
||||
|
||||
// console.log('translationLocal ~ translationLocal:', translationLocal)
|
||||
// const translationApi = translationItemsArr.map((item: string): string => {
|
||||
// return `${staticUrl}/${baseType}/tmp/${item}.json`
|
||||
// })
|
||||
|
||||
// // API 데이터 가져오기
|
||||
// const fetchDataPromises = translationApi.map((apiUrl) => {
|
||||
// return useFetch(apiUrl, {
|
||||
// method: 'GET',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8'
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
const translationApi = `${rootPath}/${runType}/test/multilingual/test_common_template.json`
|
||||
|
||||
try {
|
||||
// const fetchResults = await Promise.all(fetchDataPromises)
|
||||
const { data } = await useFetch(translationApi, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
|
||||
// // 각 결과에서 locale에 맞는 데이터를 추출
|
||||
// const apiData = fetchResults.map((result) => {
|
||||
// return result.data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
// })
|
||||
|
||||
// // apiData를 이용해 자동으로 병합
|
||||
// const mergedResult = apiData.reduce((acc, data) => {
|
||||
// return { ...acc, ...data }
|
||||
// }, {})
|
||||
if(locale === 'zh-tw') {
|
||||
locale = 'zh-TW'
|
||||
}
|
||||
|
||||
// API 데이터에서 locale에 맞는 데이터를 추출
|
||||
const apiData = data.value?.[locale] || {} // locale에 맞는 데이터가 없으면 빈 객체 반환
|
||||
|
||||
// common.json에서 해당 locale의 데이터를 가져와서 병합
|
||||
const commonLocaleData = commonData[locale] || {}
|
||||
|
||||
// API 데이터와 common.json 데이터를 병합 (common.json이 우선순위)
|
||||
// const finalResult = { ...mergedResult, ...commonLocaleData }
|
||||
const finalResult = { ...commonLocaleData }
|
||||
|
||||
// 병합된 결과 출력
|
||||
// console.log('finalResult:', finalResult)
|
||||
const finalResult = { ...apiData }
|
||||
|
||||
return finalResult
|
||||
} catch (error) {
|
||||
|
||||
@@ -11,6 +11,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const { locale } = useI18n()
|
||||
|
||||
const mainRef = ref<HTMLElement>()
|
||||
|
||||
@@ -47,12 +48,18 @@ const setupSeoMeta = (metaTag: PageDataMetaTag) => {
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const { sendLog } = useAnalytics()
|
||||
sendLog(locale.value, useAnalyticsLogDataDirect('view', 1))
|
||||
})
|
||||
|
||||
// 메타 태그 설정 감시
|
||||
watchEffect(() => {
|
||||
if (shouldShowMetaTag.value && props.pageData?.meta_tag_json) {
|
||||
setupSeoMeta(props.pageData?.meta_tag_json)
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -18,8 +18,8 @@ declare const ttq: any
|
||||
* @returns 분석용 로그 데이터 객체 (ref 없이)
|
||||
*/
|
||||
export const useAnalyticsLogDataDirect = (
|
||||
resourcesData: PageDataResourceGroup,
|
||||
pageVerTmplSeq: number
|
||||
resourcesData: PageDataResourceGroup | string,
|
||||
pageVerTmplSeq: number | null
|
||||
) => {
|
||||
const store = usePageDataStore()
|
||||
const pageData = store.pageData
|
||||
@@ -27,25 +27,41 @@ export const useAnalyticsLogDataDirect = (
|
||||
if (!pageData) {
|
||||
return {} as AnalyticsDetailType
|
||||
}
|
||||
// const pageDataTrack = (typeof resourcesData.tracking === 'object' ? resourcesData.tracking : {}) as AnalyticsLogDataTracking
|
||||
|
||||
// resourcesData가 문자열인 경우 (예: 'view')
|
||||
if (typeof resourcesData === 'string') {
|
||||
const logData = {
|
||||
actionType: resourcesData,
|
||||
event: pageData.page_name,
|
||||
eventCategory: pageData.page_name,
|
||||
} as unknown as AnalyticsDetailType
|
||||
|
||||
if (resourcesData === 'view') {
|
||||
logData.viewArea = pageData.page_name_en
|
||||
logData.viewType = 'pageView'
|
||||
}
|
||||
|
||||
return logData
|
||||
}
|
||||
|
||||
// resourcesData가 객체인 경우 (기존 로직)
|
||||
const pageDataTrack = resourcesData.tracking
|
||||
|
||||
const logData = {
|
||||
actionType: pageDataTrack?.action_type,
|
||||
// logSourceType:pageDataTrack.logSourceType,
|
||||
// viewArea:pageDataTrack.viewArea,
|
||||
// viewType:pageDataTrack.viewType,
|
||||
clickArea: pageData.page_name_en, //페이지타이틀(영문)
|
||||
clickSarea: pageData.templates[pageVerTmplSeq].page_ver_tmpl_name_en,
|
||||
clickItem: `${pageData.templates[pageVerTmplSeq].page_ver_tmpl_name}_${pageDataTrack?.click_item}`,
|
||||
event: pageData.page_name,
|
||||
eventCategory: `${pageData.page_name}_${pageDataTrack?.click_item}`,
|
||||
// template_code: pageData.templates[pageVerTmplSeq].template_code,
|
||||
// page_ver_tmpl_name: pageData.templates[pageVerTmplSeq].page_ver_tmpl_name,
|
||||
// page_ver_tmpl_name_en:
|
||||
// pageData.templates[pageVerTmplSeq].page_ver_tmpl_name_en,
|
||||
eventCategory: `${pageData.page_name}_${pageDataTrack?.click_sarea}_${pageDataTrack?.click_item}`,
|
||||
} as unknown as AnalyticsDetailType
|
||||
|
||||
if(pageDataTrack.action_type === 'click') {
|
||||
logData.clickArea = pageData.page_name_en
|
||||
logData.clickSarea = pageDataTrack.click_sarea
|
||||
logData.clickItem = pageDataTrack.click_item
|
||||
} else if(pageDataTrack.action_type === 'view') {
|
||||
logData.viewArea = pageData.page_name_en
|
||||
logData.viewType = 'view_frame'
|
||||
}
|
||||
|
||||
return logData
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user