-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add i18n support for client component and typesafety for i18n keys
- Loading branch information
Showing
18 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { enUS, frFR } from '@clerk/localizations'; | ||
import { ClerkProvider } from '@clerk/nextjs'; | ||
|
||
export default function AuthLayout({ | ||
children, // will be a page or nested layout | ||
params: { locale }, | ||
}: { | ||
children: React.ReactNode; | ||
params: { locale: string }; | ||
}) { | ||
let clerkLocale = enUS; | ||
|
||
if (locale === 'fr') { | ||
clerkLocale = frFR; | ||
} | ||
|
||
return <ClerkProvider localization={clerkLocale}>{children}</ClerkProvider>; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { getRequestConfig } from 'next-intl/server'; | ||
|
||
// Using internationalization in Server Components | ||
export default getRequestConfig(async ({ locale }) => ({ | ||
messages: (await import(`../messages/${locale}.json`)).default, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* eslint-disable @typescript-eslint/consistent-type-imports */ | ||
// Use type safe message keys with `next-intl` | ||
type Messages = typeof import('../../messages/en.json'); | ||
declare interface IntlMessages extends Messages {} |