mirror of
https://github.com/Lapikud/tipilan.git
synced 2026-03-23 21:34:21 +00:00
18 lines
515 B
TypeScript
18 lines
515 B
TypeScript
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,
|
|
};
|
|
});
|