Skip to content

Commit 72d29df

Browse files
authoredFeb 28, 2025··
Merge pull request #367 from map-of-pi/resolve-i18n-config
Self-approved; Resolve deprecated i18n request configuration.
2 parents 0b6eab9 + 79588a7 commit 72d29df

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed
 

‎i18n/i18n.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Can be imported from a shared config
2+
export const locales = [
3+
'ar',
4+
'en',
5+
'en-GB',
6+
'es',
7+
'ewe-BJ',
8+
'fon-BJ',
9+
'fr',
10+
'hau-NG',
11+
'yor-NG',
12+
'ja',
13+
'ko',
14+
'vi',
15+
'zh-CN',
16+
'zh-TW'
17+
] as const;
18+
19+
export const defaultLocale = 'en';
Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
import { notFound } from 'next/navigation';
22
import { getRequestConfig } from 'next-intl/server';
3-
4-
// Can be imported from a shared config
5-
export const locales = [
6-
'ar',
7-
'en',
8-
'en-GB',
9-
'es',
10-
'ewe-BJ',
11-
'fon-BJ',
12-
'fr',
13-
'hau-NG',
14-
'yor-NG',
15-
'ja',
16-
'ko',
17-
'vi',
18-
'zh-CN',
19-
'zh-TW'
20-
] as const;
21-
22-
export const defaultLocale = 'en';
3+
import { locales } from './i18n';
234

245
export default getRequestConfig(async ({ locale }) => {
256
// Validate that the incoming `locale` parameter is valid
@@ -28,4 +9,4 @@ export default getRequestConfig(async ({ locale }) => {
289
return {
2910
messages: (await import(`../messages/${locale}.json`)).default,
3011
};
31-
});
12+
});

‎next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import createNextIntlPlugin from 'next-intl/plugin';
22
import { withSentryConfig } from "@sentry/nextjs";
33

4-
const withNextIntl = createNextIntlPlugin();
4+
const withNextIntl = createNextIntlPlugin('./i18n/request.ts');
55

66
/** @type {import('next').NextConfig} */
77
const nextConfig = {

‎src/app/[locale]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextIntlClientProvider, useMessages } from 'next-intl';
22
import { setRequestLocale } from 'next-intl/server';
33
import { Lato } from 'next/font/google';
4-
import { locales } from '@/i18n';
4+
import { locales } from '../../../i18n/i18n';
55
import { Providers } from '../providers';
66
import Navbar from '@/components/shared/navbar/Navbar';
77
import logger from '../../../logger.config.mjs';

‎src/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import createMiddleware from 'next-intl/middleware';
2-
import { locales, defaultLocale } from './i18n';
2+
import { locales, defaultLocale } from '../i18n/i18n';
33
import { localePrefix } from './navigation';
44

55
export default createMiddleware({

‎src/navigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createSharedPathnamesNavigation } from 'next-intl/navigation';
2-
import { locales } from './i18n';
2+
import { locales } from '../i18n/i18n';
33

44
export const localePrefix = 'as-needed';
55

0 commit comments

Comments
 (0)
Please sign in to comment.