Merge version_3 into main
Merge version_3 into main
This commit was merged in pull request #8.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Pathnames } from 'next-intl';
|
|
||||||
|
|
||||||
export const locales = ['en', 'ar'] as const;
|
export const locales = ['en', 'ar'] as const;
|
||||||
export const defaultLocale = 'ar'; // Set default to Arabic as current content is Arabic
|
export const defaultLocale = 'ar'; // Set default to Arabic as current content is Arabic
|
||||||
@@ -11,6 +11,6 @@ export const localePrefix = 'always';
|
|||||||
// but useful if you plan to have separate pages later (e.g., /en/about vs /ar/about)
|
// but useful if you plan to have separate pages later (e.g., /en/about vs /ar/about)
|
||||||
export const pathnames = {
|
export const pathnames = {
|
||||||
'/': '/',
|
'/': '/',
|
||||||
} satisfies Pathnames<typeof locales>;
|
};
|
||||||
|
|
||||||
export type AppPathnames = keyof typeof pathnames;
|
export type AppPathnames = keyof typeof pathnames;
|
||||||
|
|||||||
10
src/i18n.ts
10
src/i18n.ts
@@ -1,11 +1,5 @@
|
|||||||
import { getRequestConfig } from 'next-intl';
|
|
||||||
import { notFound } from 'next/navigation';
|
|
||||||
import { locales } from './config';
|
import { locales } from './config';
|
||||||
|
|
||||||
export default getRequestConfig(async ({ locale }) => {
|
|
||||||
if (!locales.includes(locale as any)) notFound();
|
|
||||||
|
|
||||||
return {
|
|
||||||
messages: (await import(`../messages/${locale}.json`)).default,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user