Initial commit
This commit is contained in:
8
apps/web/i18n/navigation.ts
Normal file
8
apps/web/i18n/navigation.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { createNavigation } from 'next-intl/navigation';
|
||||
import { routing } from './routing';
|
||||
|
||||
/**
|
||||
* Type-safe locale-aware navigation helpers.
|
||||
* Use these instead of the plain Next.js Link and useRouter.
|
||||
*/
|
||||
export const { Link, redirect, usePathname, useRouter, getPathname } = createNavigation(routing);
|
||||
16
apps/web/i18n/request.ts
Normal file
16
apps/web/i18n/request.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { getRequestConfig } from 'next-intl/server';
|
||||
import { routing } from './routing';
|
||||
|
||||
/**
|
||||
* Per-request next-intl configuration.
|
||||
* Loads the aggregated messages file for the resolved locale.
|
||||
*/
|
||||
export default getRequestConfig(async ({ requestLocale }) => {
|
||||
const locale = (await requestLocale) ?? routing.defaultLocale;
|
||||
|
||||
return {
|
||||
locale,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
messages: (await import(`../messages/${locale}.json`)).default,
|
||||
};
|
||||
});
|
||||
12
apps/web/i18n/routing.ts
Normal file
12
apps/web/i18n/routing.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { defineRouting } from 'next-intl/routing';
|
||||
import { locales, defaultLocale } from '@dwellops/i18n';
|
||||
|
||||
/**
|
||||
* next-intl routing configuration.
|
||||
* Locale-prefixed routes: /en/dashboard, etc.
|
||||
*/
|
||||
export const routing = defineRouting({
|
||||
locales,
|
||||
defaultLocale,
|
||||
localePrefix: 'always',
|
||||
});
|
||||
Reference in New Issue
Block a user