Static ReadonlyCOOKIEThe chooser's cookie name.
Static ReadonlyROW_The collapsed language row's CSS (#1289), for a server-drawn page's own
stylesheet: WebLocale.ROW_CSS.
StaticambientThe request this code runs inside, where there is one: audit.js's
ambient request, reached LAZILY as passkey_policy.ts reaches it, so
this module stays a leaf.
the request, or null
StaticchooserDraws the language chooser: a form posting to the chooser endpoint, the offered locales by their own names, and a submit button.
the page's translator
the realm's path prefix ('', or /realm/acme). NOT put
on the form's action: app.js adds the realm's prefix to every
root-relative action in a page drawn inside a realm, so prefixing it
here posted to /realm/acme/realm/acme/authn/language. Kept so the
callers did not change; the return path carries its own prefix,
because a value is not rewritten.
the path to come back to; held to a local one
the chooser as HTML
StaticconsoleThe admin console's language (#539 phase 5): the negotiation for the
signed-in administrator and the console's own application, its catalogs
as data for the browser's WebTranslator, and the locales the chooser
offers. GET /admin-api/console answers it as its locale member.
the request
the console's application and the administrator
{ negotiated, catalogs, offered }
StaticconsoleThe console's language WITHOUT its catalogs (#1333): the negotiation, the offered languages, and where each catalog along the chain is. The catalogs are over a megabyte, the same for everybody, and hold no secret. In an API answer they could be neither compressed (BREACH) nor cached; as a static file they are both, at the edge too, under this build's address.
the request
the application and person it is for
{ negotiated, offered, catalogFiles: { <tag>: <path> } }
StaticcookieThe Set-Cookie line for the chooser's choice: a year, the whole site,
SameSite=Lax, HttpOnly, and Secure where the service is https.
the canonical tag chosen
the header value
StaticforBuilds the translator for a page drawn inside the AMBIENT request — for a
page builder that is not handed the request, which is most of them: they
are called from dozens of places, many inside a POST. The builder passes
what it knows (the application, ui_locales, the person); the request's
cookie and Accept-Language come from the ambient request.
Optionalpage: PageFor
the application, ui_locales and person, where known
the translator
StatichereThe path the chooser returns to: the caller's own, plus the listed parameters of the current GET.
the page's own path and the query it needs
Optionalkeep: string[]
the request's parameters to carry as well, on a GET
the path
StatichtmlThe attributes of a page's <html> element: lang and dir.
the page's translator
lang="…" dir="…", escaped
StaticpreferencesLists a request's language preferences, best first, in #539's order — everything but the policy's default, which is the last resort.
the request
Optionalpage: PageFor
what the caller knows about the page
canonical tags, best first, each once
StaticsafeHolds a return path to a local path: one that starts with a single /,
names no scheme or host, and carries no control character or backslash.
Anything else is /.
the path the chooser posted
a safe local path
StaticshellThe language attributes a static surface's shell carries on its
<html> (#570), for its runtime to choose the page's language in the
browser: the version, the chooser's choice (the cookie is HttpOnly, so
the browser cannot read it), the locale policy's default for the
surface's application and, where known, its person, and the build the
catalogs are keyed by. Each value is canonical or this build's own, so
nothing a request sent is drawn back as it arrived.
the request for the shell
the surface's application, for the policy
Optionalperson: string
the person the shell is drawn for, where the route serving it already holds one (#1238: their groups may name the profile); '' where nobody is known yet
[[name, value], ...], for ShellDocument.document()
StatictranslatorBuilds the translator a page is drawn with.
the request
Optionalpage: PageFor
the application, ui_locales and person, where known
the translator
Which language a page is drawn in, and the language chooser.
A static utility class; it holds no state.