Intl-T

Edge

Running Intl-T on Edge runtimes and under strict CSP

Intl-T runs on Edge runtimes — Next.js middleware/proxy on the Edge runtime, Vercel Edge Functions, Cloudflare Workers. Importing the library is safe there: nothing evaluates code at module scope, and the routing proxy imports only request primitives — no React, no Node-only APIs.

Callable nodes

Nodes are callable (t.greetings({ name: "John" })) because they are built on Function, and building one compiles code. Where that is not allowed — the Next.js Edge runtime, Cloudflare Workers, a strict CSP without unsafe-eval — Intl-T falls back to plain-object nodes automatically. The check is a capability probe, not a feature check: these runtimes keep eval defined and refuse to compile, so asking whether it exists would give the wrong answer.

You can also opt out explicitly anywhere, without waiting for the probe:

INTL_T_CALLABLE=false

With callable off, nodes are string-like objects instead of functions. Property access, String(node), and JSX rendering are unchanged (and no longer need the React patch) — only direct calls change form:

t.hello; //  works everywhere
t.greetings({ name: "John" }); //  callable nodes only — throws when disabled
t.greetings.use({ name: "John" }); //  the non-callable equivalent
t.get("hello"); //  path form; `.get` and `.use` are the same method

What needs eval

Variable injection evaluates expressions lazily and falls back safely when it can't:

Message featureWithout eval
{name}, ICU plural/select categories (one, other, few, …)work
exact-match selectors (=0 {No items})fall through to the word categories
computed expressions ({(count*2)})render literally

Environment flags

All flags are read via globalThis.process?.env, so they are safe on runtimes without process.

FlagEffect
INTL_T_CALLABLE=falseplain-object nodes; call via .use() / .get()
INTL_T_DISABLED_EVAL=1never evaluate expressions in messages

If you load locales dynamically, keep each loader a literal () => import("./en.json") so the bundler can see the import and ship the JSON with your Edge bundle.

On this page