Nuxt/examples/use-state/plugins/locale.server.ts

5 lines
162 B
TypeScript
Raw Normal View History

export default defineNuxtPlugin((nuxtApp) => {
const locale = useLocale()
locale.value = nuxtApp.ssrContext?.req.headers['accept-language']?.split(',')[0]
2021-10-11 17:48:03 +00:00
})