Add English translation to page with next-intl

This commit is contained in:
2025-08-20 22:00:33 +03:00
parent 02b2cce115
commit c22afa28d9
32 changed files with 1487 additions and 754 deletions

17
src/i18n/request.ts Normal file
View File

@@ -0,0 +1,17 @@
import { getRequestConfig } from "next-intl/server";
import { routing } from "./routing";
export default getRequestConfig(async ({ requestLocale }) => {
// This typically corresponds to the `[locale]` segment
let locale = await requestLocale;
// Ensure that a valid locale is used
if (!locale || !routing.locales.includes(locale as "et" | "en")) {
locale = routing.defaultLocale;
}
return {
locale: locale!,
messages: (await import(`../../translations/${locale}.json`)).default,
};
});