feat(i18n): Complete internationalization with timezone fixes and language switching
Completes full internationalization coverage for the webmail application with enhanced language support: - Replace all remaining hardcoded English strings with translation keys - Add timezone auto-detection to prevent hydration mismatches - Enable instant client-side language switching without page reload - Add 60+ new translation keys in English and French locales - Improve language switcher component with proper state management - Add health check endpoint for container orchestration All user-facing text now supports English and French with no hardcoded fallbacks, providing a fully localized experience.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
import { createNavigation } from 'next-intl/navigation';
|
||||
import { routing } from './routing';
|
||||
|
||||
export const { Link, redirect, usePathname, useRouter } = createNavigation(routing);
|
||||
+4
-9
@@ -1,16 +1,11 @@
|
||||
import { getRequestConfig } from 'next-intl/server';
|
||||
|
||||
export const locales = ['en', 'fr'] as const;
|
||||
export type Locale = (typeof locales)[number];
|
||||
export const defaultLocale: Locale = 'en';
|
||||
import { routing, type Locale } from './routing';
|
||||
|
||||
export default getRequestConfig(async ({ requestLocale }) => {
|
||||
// Get the locale from the request or use default
|
||||
let locale = await requestLocale || defaultLocale;
|
||||
let locale = await requestLocale;
|
||||
|
||||
// Validate that the incoming `locale` parameter is valid
|
||||
if (!(locales as readonly string[]).includes(locale)) {
|
||||
locale = defaultLocale;
|
||||
if (!locale || !routing.locales.includes(locale as Locale)) {
|
||||
locale = routing.defaultLocale;
|
||||
}
|
||||
|
||||
// Use static imports for better compatibility
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { defineRouting } from 'next-intl/routing';
|
||||
|
||||
export const routing = defineRouting({
|
||||
locales: ['en', 'fr'],
|
||||
defaultLocale: 'en',
|
||||
localePrefix: 'never'
|
||||
});
|
||||
|
||||
export const locales = routing.locales;
|
||||
export const defaultLocale = routing.defaultLocale;
|
||||
export type Locale = (typeof locales)[number];
|
||||
Reference in New Issue
Block a user