File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { routing } from '@/libs/i18nRouting' ;
2
- import { enUS , frFR } from '@clerk/localizations ' ;
2
+ import { ClerkLocalizations } from '@/utils/AppConfig ' ;
3
3
import { ClerkProvider } from '@clerk/nextjs' ;
4
4
import { setRequestLocale } from 'next-intl/server' ;
5
5
@@ -10,16 +10,12 @@ export default async function AuthLayout(props: {
10
10
const { locale } = await props . params ;
11
11
setRequestLocale ( locale ) ;
12
12
13
- let clerkLocale = enUS ;
13
+ const clerkLocale = ClerkLocalizations . supportedLocales [ locale ] ?? ClerkLocalizations . defaultLocale ;
14
14
let signInUrl = '/sign-in' ;
15
15
let signUpUrl = '/sign-up' ;
16
16
let dashboardUrl = '/dashboard' ;
17
17
let afterSignOutUrl = '/' ;
18
18
19
- if ( locale === 'fr' ) {
20
- clerkLocale = frFR ;
21
- }
22
-
23
19
if ( locale !== routing . defaultLocale ) {
24
20
signInUrl = `/${ locale } ${ signInUrl } ` ;
25
21
signUpUrl = `/${ locale } ${ signUpUrl } ` ;
Original file line number Diff line number Diff line change
1
+ import type { LocalizationResource } from '@clerk/types' ;
1
2
import type { LocalePrefixMode } from 'next-intl/routing' ;
3
+ import { enUS , frFR } from '@clerk/localizations' ;
2
4
3
5
const localePrefix : LocalePrefixMode = 'as-needed' ;
4
6
@@ -9,3 +11,13 @@ export const AppConfig = {
9
11
defaultLocale : 'en' ,
10
12
localePrefix,
11
13
} ;
14
+
15
+ const supportedLocales : Record < string , LocalizationResource > = {
16
+ en : enUS ,
17
+ fr : frFR ,
18
+ } ;
19
+
20
+ export const ClerkLocalizations = {
21
+ defaultLocale : enUS ,
22
+ supportedLocales,
23
+ } ;
You can’t perform that action at this time.
0 commit comments