fix french homepage
Build & Deploy / Build & Push Docker Image (push) Failing after 49s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m6s
Test / Marketplace Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled

This commit is contained in:
root
2026-06-26 21:49:06 -04:00
parent 35172ab46b
commit 7962bf9a92
6 changed files with 19 additions and 11 deletions
-10
View File
@@ -46,16 +46,6 @@ const nextConfig: NextConfig = {
destination: '/dashboard/:path*', destination: '/dashboard/:path*',
permanent: false, permanent: false,
}, },
{
source: '/sign-in',
destination: '/en/sign-in',
permanent: false,
},
{
source: '/forgot-password',
destination: '/en/forgot-password',
permanent: false,
},
]; ];
}, },
Binary file not shown.

After

Width:  |  Height:  |  Size: 836 KiB

@@ -1,6 +1,7 @@
'use client'; 'use client';
import { localizedPath, locales, type Locale } from '@/lib/localization/config'; import { localizedPath, locales, type Locale } from '@/lib/localization/config';
import { persistLocale } from '@/lib/localization/client';
import { persistTheme, themePreferenceEvent } from '@/lib/theme/client'; import { persistTheme, themePreferenceEvent } from '@/lib/theme/client';
import { type ThemePreference } from '@/lib/theme/config'; import { type ThemePreference } from '@/lib/theme/config';
import Image from 'next/image'; import Image from 'next/image';
@@ -62,6 +63,7 @@ export function AuthHeader({ locale, themePreference: initialPref }: Props) {
const switchLocale = (next: Locale) => { const switchLocale = (next: Locale) => {
setLocaleOpen(false); setLocaleOpen(false);
persistLocale(next);
const segments = pathname.split('/').filter(Boolean); const segments = pathname.split('/').filter(Boolean);
if (segments.length >= 2) segments[1] = next; if (segments.length >= 2) segments[1] = next;
router.push('/' + segments.join('/')); router.push('/' + segments.join('/'));
@@ -3,6 +3,7 @@
import { usePathname } from 'next/navigation'; import { usePathname } from 'next/navigation';
import { SiteHeader } from './SiteHeader'; import { SiteHeader } from './SiteHeader';
import { AuthHeader } from './AuthHeader'; import { AuthHeader } from './AuthHeader';
import { routeIdFromPathname } from '@/lib/localization/config';
import type { ShellMessages } from '@/lib/localization/messages'; import type { ShellMessages } from '@/lib/localization/messages';
import type { Locale } from '@/lib/localization/config'; import type { Locale } from '@/lib/localization/config';
import type { ThemePreference } from '@/lib/theme/config'; import type { ThemePreference } from '@/lib/theme/config';
@@ -15,7 +16,8 @@ interface Props {
export function HeaderRouter({ locale, messages, themePreference }: Props) { export function HeaderRouter({ locale, messages, themePreference }: Props) {
const pathname = usePathname(); const pathname = usePathname();
const isAuth = pathname.endsWith('/sign-in') || pathname.endsWith('/forgot-password'); const routeId = routeIdFromPathname(pathname);
const isAuth = routeId === 'sign-in' || routeId === 'forgot-password';
if (isAuth) { if (isAuth) {
return <AuthHeader locale={locale} themePreference={themePreference} />; return <AuthHeader locale={locale} themePreference={themePreference} />;
@@ -61,6 +61,7 @@
color: var(--text-primary); color: var(--text-primary);
font-weight: 650; font-weight: 650;
text-decoration: none; text-decoration: none;
white-space: nowrap;
} }
.navigation a { .navigation a {
+13
View File
@@ -44,6 +44,19 @@ export function proxy(request: NextRequest): NextResponse {
return applySecurityHeaders(response, csp); return applySecurityHeaders(response, csp);
} }
// Redirect locale-less paths (e.g. /sign-in → /en/sign-in), but not /dashboard, /admin, or files
const firstSegment = request.nextUrl.pathname.split('/')[1];
const isFile = /\.\w+$/.test(request.nextUrl.pathname);
if (firstSegment && !isFile && !isLocale(firstSegment) && firstSegment !== 'dashboard' && firstSegment !== 'admin') {
const cookieLocale = request.cookies.get(localeCookie)?.value;
const locale = isLocale(cookieLocale)
? cookieLocale
: localeFromAcceptLanguage(request.headers.get('accept-language')) || defaultLocale;
const destination = request.nextUrl.clone();
destination.pathname = `/${locale}${request.nextUrl.pathname}`;
return applySecurityHeaders(NextResponse.redirect(destination), csp);
}
const response = NextResponse.next({ request: { headers: requestHeaders } }); const response = NextResponse.next({ request: { headers: requestHeaders } });
const explicitLocale = request.nextUrl.pathname.split('/')[1]; const explicitLocale = request.nextUrl.pathname.split('/')[1];
if (isLocale(explicitLocale)) { if (isLocale(explicitLocale)) {