-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a36314
commit ee9f3df
Showing
9 changed files
with
66 additions
and
7 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
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,6 @@ | ||
import { useTranslations } from 'next-intl' | ||
|
||
export default function Index() { | ||
const t = useTranslations('common') | ||
return <h1>{t('coverage')}</h1> | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NextIntlClientProvider } from 'next-intl' | ||
import { getMessages } from 'next-intl/server' | ||
import type { ReactNode } from 'react' | ||
|
||
export default async function LocaleLayout({ | ||
children, | ||
params: { locale }, | ||
}: { | ||
children: ReactNode | ||
params: { locale: string } | ||
}) { | ||
const messages = await getMessages() | ||
|
||
return ( | ||
<html lang={locale}> | ||
<body> | ||
<NextIntlClientProvider messages={messages}>{children}</NextIntlClientProvider> | ||
</body> | ||
</html> | ||
) | ||
} |
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,14 @@ | ||
import createMiddleware from 'next-intl/middleware' | ||
|
||
export default createMiddleware({ | ||
// A list of all locales that are supported | ||
locales: ['en', 'de'], | ||
|
||
// Used when no locale matches | ||
defaultLocale: 'en', | ||
}) | ||
|
||
export const config = { | ||
// Match only internationalized pathnames | ||
matcher: ['/', '/(en|es)/:path*'], | ||
} |
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,14 @@ | ||
import { notFound } from 'next/navigation' | ||
import { getRequestConfig } from 'next-intl/server' | ||
|
||
// Can be imported from a shared config | ||
const locales = ['en', 'es'] | ||
|
||
export default getRequestConfig(async ({ locale }) => { | ||
// Validate that the incoming `locale` parameter is valid | ||
if (!locales.includes(locale as any)) notFound() | ||
|
||
return { | ||
messages: (await import(`../translations/${locale}.json`)).default, | ||
} | ||
}) |
File renamed without changes.
File renamed without changes.