Impedisce l'auto-traduzione del browser e fissa il locale TH/EN esplicito.

Chrome traduceva il tailandese in inglese allo scroll; html translate=no e prop locale sulle route.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Javaxman
2026-07-30 11:39:27 +02:00
parent 04a1892c0d
commit ef343a31b5
5 changed files with 20 additions and 7 deletions

View File

@ -2,4 +2,4 @@
import Page from '../index.astro';
---
<Page />
<Page locale="en" />

View File

@ -16,10 +16,19 @@ import {
getFaq,
getCta,
} from '../data/home';
import type { SupportedLocale } from '../data/home/navigation';
interface Props {
/** Locale esplicito dalle route /en e /th (evita ambiguità se la page è importata come componente). */
locale?: SupportedLocale;
}
const { locale: localeProp } = Astro.props;
const path = Astro.url.pathname;
const localeMatch = path.match(/^\/(en|th)(\/|$)/);
const currentLocale = (localeMatch?.[1] ?? 'it') as 'it' | 'en' | 'th';
const currentLocale = (localeProp ??
(localeMatch?.[1] as SupportedLocale | undefined) ??
'it') as SupportedLocale;
const navigation = getNavigation(currentLocale);
const siteMeta = getSiteMeta(currentLocale);
const hero = getHero(currentLocale);

View File

@ -2,4 +2,4 @@
import Page from '../index.astro';
---
<Page />
<Page locale="th" />