Skip to content

Commit

Permalink
unnecessary condition
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Mar 6, 2024
1 parent 0ef4bb5 commit 86af78a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ Temporary Items

*.tgz
.prettierrc
.vscode
10 changes: 5 additions & 5 deletions src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
import { getLocaleFromRoute } from './utils'
import { options } from '#build/i18n'

const clean = (str: string) => str.split('-')[0].trim().toLowerCase()

export default defineNuxtPlugin({
name: 'nuxt-i18n-plugin',
enforce: 'pre',
Expand Down Expand Up @@ -58,11 +56,13 @@ export default defineNuxtPlugin({
}

const targetLocale = getLocaleFromRoute(to) || options.defaultLocale
if (targetLocale && options.locales.includes(targetLocale)) {
useState<string>('locale').value = targetLocale
}
useState<string>('locale').value = targetLocale
},
{ global: true }
)
}
})

function clean(str: string) {
return str.split('-')[0].trim().toLowerCase()
}

0 comments on commit 86af78a

Please sign in to comment.