---
title: "Platform facts and localization"
description: "Host-owned facts arrive through five reserved sources: exactViewport, exactPage, exactDelivery, exactSurface, and exactTime (the date, locale and time zone)."
modificationDate: "2026-11-30"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Platform facts and localization

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/learn/contract-for-humans/platform-facts-and-localization: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

Host-owned facts arrive through five reserved sources: `exactViewport`,
`exactPage`, `exactDelivery`, `exactSurface`, and `exactTime` (the date, locale and
time zone). Declare the fields you read with their supported names and types;
the bake refuses a field the source does not have, though compilation alone does
not.

```contract
shape Viewport
  width: number
  height: number

component Responsive
  resource viewport = exactViewport() as shape Viewport
  view
    column
      if viewport.width >= 900
        text "Wide layout"
      else
        text "Compact layout"
```

`exactPage().platform` identifies the host from the first frame. Declare
`platform: string` or an enum over the following values in the page resource's shape.
The native hosts report
`ios`, `macos`, `tvos`, `watchos`, `android`, `linux` or `windows`.
A browser or server-rendered web page reports `web`, a terminal app reports
`terminal`, and a runner booted without a host reports `headless`. A browser
on an Android phone therefore reports `web`.

`exactPage` answers the page's facts by the web's names: `visibilityState`
(`"visible"` or `"hidden"`), `onLine`, `canShare`, `canOpenFiles`, and
`hasFocus`, which is `document.hasFocus()`: true while the app's window has the
system's focus, false while another app or window is in front. An app that
tells the person something can show it in the window while it has focus and
post a notification otherwise.

```contract
shape Page
  hasFocus: bool

component Finished
  resource page = exactPage() as shape Page
  view
    main
      if page.hasFocus
        text "Build finished" role="status"
```

Prefer responsive branches driven by dimensions and actual capabilities to
inventing platform-specific Contract files. Safe-area lengths use CSS `env()`;
viewport metadata uses the root element's `viewport-fit` and `interactive-widget`
attributes. `exactViewport` also carries `prefersReducedMotion`,
`prefersReducedTransparency`, `prefersContrast` and `prefersColorScheme`: facts
for the app to honor, not automatic engine policy. `displayMode: string` reads
CSS's current `display-mode`: the browser's media query on the web (in Chrome,
an agent's `prefer display-mode` replaces the reading and leaves the query
alone), `fullscreen` or `standalone` for the window on macOS, and `standalone`
on other native hosts. On `exactPage`, `navigationType` is how the browser loaded the page
(`navigate`, `reload` or `back_forward`), and empty in a native app. Available fields are documented beside their source validation (LLP 1039); start with [the viewport corpus](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/corpus/viewport.contract).

Localized strings live in the app's `strings/<locale>.json` files. Author calls
such as `t("greeting", name=person.name)`, with `{name}` in the table value. The
key must be a literal; keys and placeholder names are checked at compilation. The
base table is `en` unless `app.json` sets `strings.base`, and a translation may
omit keys but not add them. The locale comes from the host; lookup falls back from
the exact tag to shorter tags, then to the base. An app's own language setting
calls `setLocale("de")` in its action, and `setLocale("")` for "System": the
choice stands over the host's locale, is kept across launches, and applies before
the next launch's first frame, so the setting needs no mount task.
`exactTime().resolvedLocale` follows it; `locale` and `formatLocale` stay the
device's. See
[the locale fixture](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/conformance/locale) and
[the string tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/strings.rs).

`formatTime`, `formatDate`, `formatDay` and `formatNumber` are deterministic
formatting calls with specific accepted format literals. They format in the
locale of the strings table the app shows, as `Intl` formats it: with a `de` table
`formatDate(at, offset, "medium")` is `26.09.2026` and `formatNumber(1234.5,
"decimal")` is `1.234,5`, and `setLocale` moves them with the text. An app with no
tables, or only English ones, prints en-US. A table's region is its formats' region,
so an app that wants British dates ships `strings/en-GB.json` (it may be `{}`).
The viewer's forced 12- or 24-hour clock applies; dates are Gregorian in every
locale ([formatting by locale](https://exact.expo.dev/reference/contract-grammar/standard-functions-and-intrinsics.md#formatting-by-locale)). Their
vocabulary is not a general `Intl` options object. App-specific wording belongs in
app `fn`s.
