diff --git a/i18n/locales/ko.ts b/i18n/locales/ko.ts index e7f3c28..9f08531 100644 --- a/i18n/locales/ko.ts +++ b/i18n/locales/ko.ts @@ -7,23 +7,14 @@ export default defineI18nLocale(async (locale: string) => { 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' - } - }) - - // 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] || {} + const result = (await commonFetch('GET', `${translationApi}`)) as any + if(import.meta.client) { + console.log("🚀 ~ result:", result[locale]) + } + return result[locale] + } catch (e) { + console.error('[Exception] ko.defineI18nLocale: ', e) + return fallback } }) + diff --git a/i18n/locales/zh-tw.ts b/i18n/locales/zh-tw.ts index 46de894..9f08531 100644 --- a/i18n/locales/zh-tw.ts +++ b/i18n/locales/zh-tw.ts @@ -7,28 +7,14 @@ export default defineI18nLocale(async (locale: string) => { 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' - } - }) - - - if(locale === 'zh-tw') { - locale = 'zh-TW' + const result = (await commonFetch('GET', `${translationApi}`)) as any + if(import.meta.client) { + console.log("🚀 ~ result:", result[locale]) } - - // 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] || {} + return result[locale] + } catch (e) { + console.error('[Exception] ko.defineI18nLocale: ', e) + return fallback } }) +