feat: add next-intl, supports en/zh/de languages
This commit is contained in:
parent
a4e7a59e17
commit
72005865f3
@ -4,15 +4,17 @@ import { withContentCollections } from "@content-collections/next";
|
||||
|
||||
/**
|
||||
* https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#next-config
|
||||
*
|
||||
* Explicitly specify the path to the request config file
|
||||
*/
|
||||
const withNextIntl = createNextIntlPlugin();
|
||||
|
||||
module.exports = {
|
||||
experimental: {
|
||||
// https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
|
||||
missingSuspenseWithCSRBailout: false,
|
||||
},
|
||||
}
|
||||
// module.exports = {
|
||||
// experimental: {
|
||||
// // https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
|
||||
// missingSuspenseWithCSRBailout: false,
|
||||
// },
|
||||
// }
|
||||
|
||||
/**
|
||||
* https://nextjs.org/docs/app/api-reference/config/next-config-js
|
||||
|
@ -32,8 +32,6 @@ export default async function HomePage(props: HomePageProps) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <PromotekitScript /> */}
|
||||
|
||||
<div className="mt-12 flex flex-col gap-16">
|
||||
|
||||
<div className="text-center">
|
||||
|
@ -21,18 +21,18 @@ interface LocaleLayoutProps {
|
||||
params: Promise<{ locale: string }>;
|
||||
};
|
||||
|
||||
export function generateStaticParams() {
|
||||
return routing.locales.map((locale) => ({ locale }));
|
||||
}
|
||||
// export function generateStaticParams() {
|
||||
// return routing.locales.map((locale) => ({ locale }));
|
||||
// }
|
||||
|
||||
export async function generateMetadata(props: Omit<LocaleLayoutProps, 'children'>) {
|
||||
const { locale } = await props.params;
|
||||
const t = await getTranslations({ locale, namespace: 'LocaleLayout' });
|
||||
// export async function generateMetadata(props: Omit<LocaleLayoutProps, 'children'>) {
|
||||
// const { locale } = await props.params;
|
||||
// const t = await getTranslations({ locale, namespace: 'LocaleLayout' });
|
||||
|
||||
return {
|
||||
title: t('title')
|
||||
};
|
||||
}
|
||||
// return {
|
||||
// title: t('title')
|
||||
// };
|
||||
// }
|
||||
|
||||
export default async function LocaleLayout({ children, params }: LocaleLayoutProps) {
|
||||
const { locale } = await params;
|
||||
|
@ -67,11 +67,11 @@ export async function generateMetadata(
|
||||
};
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return allPosts.map((post) => ({
|
||||
slug: post.slugAsParams.split('/')
|
||||
}));
|
||||
}
|
||||
// export async function generateStaticParams() {
|
||||
// return allPosts.map((post) => ({
|
||||
// slug: post.slugAsParams.split('/')
|
||||
// }));
|
||||
// }
|
||||
|
||||
export default async function BlogPostPage(props: NextPageProps) {
|
||||
const post = await getBlogPostFromParams(props);
|
@ -10,7 +10,7 @@ export const config = {
|
||||
|
||||
// Set a cookie to remember the previous locale for
|
||||
// all requests that have a locale prefix
|
||||
'/(de|en)/:path*',
|
||||
'/(zh|de|en)/:path*',
|
||||
|
||||
// Enable redirects that add missing locales
|
||||
// (e.g. `/pathnames` -> `/en/pathnames`)
|
||||
|
Loading…
Reference in New Issue
Block a user