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:
@ -2,4 +2,4 @@
|
||||
import Page from '../index.astro';
|
||||
---
|
||||
|
||||
<Page />
|
||||
<Page locale="en" />
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
import Page from '../index.astro';
|
||||
---
|
||||
|
||||
<Page />
|
||||
<Page locale="th" />
|
||||
|
||||
Reference in New Issue
Block a user