first
This commit is contained in:
commit
8538ab969a
434 changed files with 44051 additions and 0 deletions
22
apps/web/modules/i18n/request.ts
Normal file
22
apps/web/modules/i18n/request.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { getUserLocale } from "@i18n/lib/locale-cookie";
|
||||
import { routing } from "@i18n/routing";
|
||||
import { config } from "@repo/config";
|
||||
import { getMessagesForLocale } from "@repo/i18n";
|
||||
import { getRequestConfig } from "next-intl/server";
|
||||
|
||||
export default getRequestConfig(async ({ requestLocale }) => {
|
||||
let locale = await requestLocale;
|
||||
|
||||
if (!locale) {
|
||||
locale = await getUserLocale();
|
||||
}
|
||||
|
||||
if (!(routing.locales.includes(locale) && config.i18n.enabled)) {
|
||||
locale = routing.defaultLocale;
|
||||
}
|
||||
|
||||
return {
|
||||
locale,
|
||||
messages: await getMessagesForLocale(locale),
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue