diff --git a/app/app.vue b/app/app.vue index 8e7f33e..b5e4de5 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,7 +1,24 @@ + + \ No newline at end of file diff --git a/app/components/JinshenHeader.vue b/app/components/JinshenHeader.vue index c98d003..32a23ad 100644 --- a/app/components/JinshenHeader.vue +++ b/app/components/JinshenHeader.vue @@ -31,7 +31,7 @@ v-model="searchQuery" class="search-input" :placeholder="$t('search-placeholder' @@ -51,7 +51,7 @@ const handleSearch = () => { if (searchQuery.value.trim()) { // 这里可以添加搜索逻辑,例如导航到搜索结果页面 console.log('Searching for:', searchQuery.value); - // 示例:导航到搜索结果页面 +// 示例:导航到搜索结果页面 // router.push({ path: '/search', query: { q: searchQuery.value } }); } } diff --git a/i18n/i18n.config.ts b/i18n/i18n.config.ts new file mode 100644 index 0000000..7aa410a --- /dev/null +++ b/i18n/i18n.config.ts @@ -0,0 +1,5 @@ +export default defineI18nConfig(() => ({ + legacy: false, + locale: 'zh', + fallbackLocale: 'zh', +})) \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index a1b2a1e..4cc0cf7 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -55,11 +55,17 @@ export default defineNuxtConfig({ }, i18n: { + detectBrowserLanguage: { + useCookie: true, + cookieKey: 'i18n_redirected', + redirectOn: 'root' + }, locales: [ { code: 'en', language: 'en-US', name: 'English', file: 'en.json' }, { code: 'zh', language: 'zh-CN', name: '简体中文', file: 'zh.json' }, ], defaultLocale: 'zh', + langDir: 'locales' }, modules: [