Working state: Serbian at root (/), English at /en, proper i18n structure
This commit is contained in:
15
src/i18n/index.ts
Normal file
15
src/i18n/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { getRequestConfig } from "next-intl/server";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const locales = ["en", "sr"] as const;
|
||||
export type Locale = (typeof locales)[number];
|
||||
|
||||
export default getRequestConfig(async ({ locale }) => {
|
||||
const currentLocale = locale || "sr";
|
||||
if (!locales.includes(currentLocale as Locale)) notFound();
|
||||
|
||||
return {
|
||||
locale: currentLocale,
|
||||
messages: (await import(`./messages/${currentLocale}.json`)).default,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user