mirror of
https://github.com/hanzoai/i18n.git
synced 2026-10-30 14:24:32 +00:00
@hanzo/i18n/boot exports bootScript(), an inline head script that sets <html lang dir> before the first paint: the locale the provider last showed in this browser, else the signed-out choice, else the browser's languages negotiated as resolve does. Its tables are built from the registry through resolve's own pick(), so the two answer alike. The provider records what it shows (hanzo.locale.v1.painted) and keeps an account's IAM choice in this browser, so the next load opens in it. @hanzo/i18n 0.3.2.
10 lines
367 B
TypeScript
10 lines
367 B
TypeScript
import { createElement } from 'react'
|
|
import { hydrateRoot } from 'react-dom/client'
|
|
|
|
import { Document, props } from './document.ts'
|
|
|
|
const failures: string[] = ((window as unknown as { recoverable: string[] }).recoverable = [])
|
|
hydrateRoot(document, createElement(Document, props(location.href)), {
|
|
onRecoverableError: (error) => failures.push(String(error)),
|
|
})
|