improved language support

This commit is contained in:
Sol Irvine
2023-11-13 14:50:14 +09:00
parent 7fa6ffbe2a
commit f19f7e65d8
2 changed files with 7 additions and 5 deletions

View File

@@ -71,10 +71,10 @@ const noto = Noto_Serif_JP({
variable: '--font-noto'
});
export const SupportedLocales: SupportedLocale[] = ['ja', 'en'];
const locales = ['en', 'ja'] as const;
export function generateStaticParams() {
return SupportedLocales.map((locale) => ({ locale }));
return locales.map((locale) => ({ locale }));
}
export default async function RootLayout({
@@ -85,7 +85,7 @@ export default async function RootLayout({
params: { locale?: SupportedLocale };
}) {
// Validate that the incoming `locale` parameter is valid
const isValidLocale = SupportedLocales.some((cur: string) => cur === params?.locale);
const isValidLocale = locales.some((cur: string) => cur === params?.locale);
if (!isValidLocale) notFound();
if (params?.locale) {