- Integrated `next-intl` for toast messages and locale handling in various components, including `Providers`, `CanvasUserMenu`, and `CreditOverview`. - Replaced hardcoded strings with translation keys to enhance localization capabilities. - Updated `RootLayout` to dynamically set the language attribute based on the user's locale. - Ensured consistent user feedback through localized toast messages in actions such as sign-out, canvas operations, and billing notifications.
19 lines
497 B
TypeScript
19 lines
497 B
TypeScript
import { getRequestConfig } from 'next-intl/server';
|
|
import { routing } from '../routing';
|
|
|
|
export default getRequestConfig(async ({ requestLocale }) => {
|
|
let locale = await requestLocale;
|
|
const locales = routing.locales;
|
|
type Locale = (typeof locales)[number];
|
|
|
|
if (!locale || !locales.includes(locale as Locale)) {
|
|
locale = routing.defaultLocale;
|
|
}
|
|
|
|
return {
|
|
locale,
|
|
timeZone: 'Europe/Berlin',
|
|
messages: (await import(`../messages/${locale}.json`)).default,
|
|
};
|
|
});
|