Runtime SDKs

Runtime SDKs

How your app reads published translations from the transglot CDN at runtime, and which package to use for your framework.

The runtime SDKs load your published translations over HTTP while your app runs, so a fixed typo or a new language reaches users without a new build. Every package reads the same CDN endpoint and builds on one client, @transglot/runtime.

How runtime delivery works

You publish a locale

Publishing freezes a locale's current translations into a numbered version. You publish from the project's Deploy screen, from Publish now on the Runtime delivery (CDN) card, or from your pipeline. With Freshness set to Auto: publish on every push, every push publishes. See Publish a locale.

A published bundle holds only the keys that have a translation in that locale, in the project's delivery format.

The CDN serves it

Each published locale has two addresses on https://api.transglot.ai:

AddressServesCache headers
/v1/cdn/{project}/{locale}The latest published versionpublic, a short max-age, must-revalidate, and an ETag
/v1/cdn/{project}/{locale}/v{n}Version n, which never changespublic, one year, immutable

The latest address is the one to use. Its short lifetime means a new publish reaches users within about a minute, and revalidating it is cheap: send the ETag back in If-None-Match and an unchanged bundle answers 304 Not Modified with no body. A version address suits pinning during a rollout. transglot keeps a limited number of recent versions per locale, so an old version address eventually stops resolving.

Your app reads it with a CDN key

Every read needs the project's CDN key, in the X-Transglot-Cdn-Key header or the key query parameter. A CDN key is read-only, belongs to one project, and reaches only that project's published bundles, never unpublished translations or another project's content.

Get a CDN key

Runtime delivery is available on the Starter plan and above.

  1. Open the project's Settings → Developer.
  2. In the Runtime delivery (CDN) card, under CDN keys, enter a Name (for example, the app or edge that will use it).
  3. Select New CDN key, then Copy. The key starts with taicdn_. transglot stores only a hash, so it is shown once; if you lose it, create another.

To revoke a key, select Delete next to it. Anything still using it starts receiving 401 responses immediately, including caches you do not control, so roll out its replacement first.

The same card shows each locale's Latest URL. The number after /v1/cdn/ is the project id the SDKs ask for.

Choose a package

PackageUse it forServer rendering
@transglot/runtimeAny JavaScript runtime: browsers, Node.js 20+, React Native, workersYou call it
@transglot/react-i18nReact 18 and 19No, loads after mount
@transglot/nextNext.js 14 and 15, App Router and Pages RouterYes
@transglot/vueVue 3.3 and laterNo
@transglot/svelteSvelte 5No
@transglot/sveltekitSvelteKit 2Yes
@transglot/angularAngular 17 and laterNo
@transglot/solidSolidJS 1.6 and laterNo
@transglot/astroAstro 4 and 5, with React islandsYes
@transglot/i18next-backendApps already on i18next or react-i18nextThrough i18next
@transglot/react-intlApps already on react-intl (FormatJS), and full ICU MessageFormatYou call it
@transglot/pseudoGenerating a pseudo-locale for testing; does not read the CDN

@transglot/react is not a runtime SDK: it adds the in-context editor for reviewers. See the in-context editor.

Delivery formats

The SDKs read the JSON-family delivery formats: json_flat, json_nested, laravel_json and flutter_arb. Choose one in Delivery format on the Runtime delivery (CDN) card; Project default follows the format you last pushed. Plural keys are published only in flutter_arb, as ICU plural messages; the other three leave them out. The JavaScript runtime page has the details.

Things that apply to every package

  • Missing keys. Looking up a key that is not in the bundle returns the key, or for the interop packages whatever i18next or react-intl do. No package falls back to another locale on its own.
  • Browsers. The CDN sends Access-Control-Allow-Origin: * on bundles but does not answer CORS preflight requests. In a browser, pass authIn: 'query', and read In a browser for what that means for revalidation and errors. Server-side loading is not affected.
  • Keys in client code. A CDN key in a browser bundle is visible to anyone, and it can read only what you have published for that project. The server-rendering packages keep the key on the server unless you opt into browser-side loading.
  • Rate limits. CDN reads are rate-limited per key and client address. On 429, the SDKs wait for Retry-After and retry twice before failing with rate-limited. A server that renders every request should cache bundles rather than fetch one per request.
  • Errors. Every package reports failures as RuntimeError with a stable slug. See Errors.

Without an SDK

The CDN is plain HTTP, so any language can read it:

curl -i \
  -H "X-Transglot-Cdn-Key: taicdn_your_key" \
  https://api.transglot.ai/v1/cdn/42/fr

The body is the bundle in the project's delivery format, with a matching Content-Type. The response also carries ETag, X-Cdn-Version (the published version number) and X-Cdn-Format (the format identifier). Add ?format=<identifier> to assert a format: if the version was published in a different one, the response is 404 with the problem type not-published, and an unknown identifier is 422 invalid-format. Errors are application/problem+json documents whose type is /problems/<slug>.

On this page