Skip to content

Commit 0edbd2e

Browse files
fix(i18n): set default locale to 'en' and update URL strategy
1 parent b80913b commit 0edbd2e

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

app/app.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ const breadcrumbs = computed<BreadcrumbItem[] | null>(() => {
4747
}
4848
return items
4949
})
50+
51+
// force locale to be set to 'en' for the app
52+
const { setLocale } = useI18n()
53+
await setLocale('en')
5054
</script>
5155

5256
<template>

app/error.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ useHead({
88
},
99
],
1010
})
11+
12+
const { setLocale } = useI18n()
13+
await setLocale('en')
1114
</script>
1215

1316
<template>

nuxt.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export default defineNuxtConfig({
5555

5656
i18n: {
5757
defaultLocale: 'en',
58+
// add no_prefix to avoid prefixing the locale in the URL like /de/...
59+
strategy: "no_prefix",
5860
locales: [
5961
{
6062
code: 'en',

0 commit comments

Comments
 (0)