diff --git a/Frontend-Learner/components/common/LanguageSwitcher.vue b/Frontend-Learner/components/common/LanguageSwitcher.vue index 366cae3a..02c908f2 100644 --- a/Frontend-Learner/components/common/LanguageSwitcher.vue +++ b/Frontend-Learner/components/common/LanguageSwitcher.vue @@ -43,9 +43,15 @@ const changeLocale = async (code: string) => { anchor="bottom right" self="top right" class="language-menu" + :offset="[0, 8]" > - - + + {{ $t('language.label') }} @@ -55,26 +61,51 @@ const changeLocale = async (code: string) => { clickable v-close-popup @click="changeLocale(loc.code)" - :class="{ 'active-locale': locale === loc.code }" - class="language-item" + class="language-item mx-2 mb-1 rounded-lg transition-colors duration-200" + :class="[ + locale === loc.code + ? 'bg-blue-50 dark:bg-blue-900/20' + : 'hover:bg-slate-50 dark:hover:bg-slate-800' + ]" > - + + - + {{ loc.name }} - + {{ loc.code.toUpperCase() }} + - + diff --git a/Frontend-Learner/nuxt.config.ts b/Frontend-Learner/nuxt.config.ts index 365b66f7..5bc02e87 100644 --- a/Frontend-Learner/nuxt.config.ts +++ b/Frontend-Learner/nuxt.config.ts @@ -7,11 +7,11 @@ export default defineNuxtConfig({ i18n: { strategy: 'no_prefix', defaultLocale: 'th', + langDir: 'locales', locales: [ - { code: 'th', name: 'ไทย', iso: 'th-TH' }, - { code: 'en', name: 'English', iso: 'en-US' } + { code: 'th', name: 'ไทย', iso: 'th-TH', file: 'th.json' }, + { code: 'en', name: 'English', iso: 'en-US', file: 'en.json' } ], - vueI18n: './i18n.config.ts', detectBrowserLanguage: { useCookie: true, cookieKey: 'i18n_redirected',