Skip to content

Commit c92eb40

Browse files
committed
fix: fix some error
1 parent 41ba7d1 commit c92eb40

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/i18n.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import { getRequestConfig } from 'next-intl/server';
22
import { routing } from './navigation';
33

4-
export default getRequestConfig(async ({requestLocale}) => {
4+
export default getRequestConfig(async ({ requestLocale }) => {
55
let locale = await requestLocale;
6+
67
// Ensure that a valid locale is used
78
if (!locale || !routing.locales.includes(locale as any)) {
8-
locale = routing.defaultLocale;
9+
locale = routing.defaultLocale; // Fallback to default locale
910
}
11+
12+
// Load messages for the current locale
13+
const messages = (await import(`../content/${locale}.json`)).default;
14+
1015
return {
11-
messages: (await import(`../content/${locale}.json`)).default,
16+
locale, // Return the validated locale
17+
messages,
1218
};
13-
});
19+
});

0 commit comments

Comments
 (0)