Skip to content

CDN contract

This page is the source of truth for the delivery plane. Every other page links here instead of restating paths.

The URLs below are produced at documentation build time by calling latestManifestUrl() and cdnUrl() from @localize-work/i18next-backend itself, so they cannot drift from what the SDK actually fetches.

{cdnBaseUrl}/{projectSlug}/latest.json
https://cdn.localize.work/your-project/latest.json

One small file whose entire body is the currently active release version:

{ "version": "v12" }

It is overwritten on every publish and on every rollback. It is the only mutable object in the delivery plane.

{cdnBaseUrl}/{projectSlug}/{version}/{locale}/{namespace}.json
https://cdn.localize.work/your-project/v12/en/common.json

Immutable. Once written, a file at a given version is never rewritten — not by a later publish, not by a rollback, not by editing or deleting the underlying key. Its body is plain i18next JSON; see published JSON format.

A version is the literal character v followed by a positive integer with no leading zero: v1, v2, … v12. Versions are allocated per project as the next integer above the highest existing one.

The SDK validates the pointer against /^v[1-9]\d*$/ and refuses anything else with invalid latest release pointer — a pointer body that is not this shape is treated as a configuration error, not a transient failure, so it is not retried.

  1. Fetch {cdnBaseUrl}/{projectSlug}/latest.json.
  2. Read version from the JSON body.
  3. Fetch {cdnBaseUrl}/{projectSlug}/{version}/{locale}/{namespace}.json for every locale and namespace you need.
  4. Never mix versions within one initialisation. Resolve the pointer once and reuse the version for every file.

Step 4 is not a suggestion. If you resolve the pointer per file and a publish lands between two fetches, you get half of one release and half of another — which is exactly how you ship a page where the header is translated and the button is not. The SDK resolves the pointer once per backend instance and caches it for this reason.

Pin version: 'vN' explicitly and step 1 is skipped entirely.

Terminal window
curl https://cdn.localize.work/your-project/latest.json
Terminal window
curl https://cdn.localize.work/your-project/v12/en/common.json
Path Cache-Control
{slug}/latest.json public, max-age=300
{slug}/{version}/{locale}/{ns}.json public, max-age=31536000, immutable

The files are served by localize.work’s own servers in the EU, which read them from object storage and keep recent ones in memory. Publishing or rolling back updates the server’s copy of latest.json within seconds, so the 300-second lifetime is how long a browser that already fetched the pointer may keep using it — a ceiling, not the normal latency.

A 404 is not cached, so a project’s first publish is visible as soon as it finishes.

Request 404 means
latest.json Nothing has ever been published for this project, or the slug is wrong.
{version}/{locale}/{ns}.json, base locale Real problem: that namespace has no published content in that locale.
{version}/{locale}/{ns}.json, variant locale Normal. Variants publish sparse files; an absent file means “no overrides here”.

That last row is the one that trips people up. The SDK resolves a 404 to an empty resource and lets i18next’s fallback chain supply the values — see variant locales.

A variant file — may legitimately not exist
https://cdn.localize.work/your-project/v12/en-FI/common.json

Nothing above requires our package. Two fetch calls in the right order is a complete, supported integration:

const { version } = await fetch(`${cdnBaseUrl}/${slug}/latest.json`).then((r) => r.json());
const common = await fetch(
`${cdnBaseUrl}/${slug}/${version}/en/common.json`,
).then((r) => r.json());

Resolve the pointer once, at startup — not per key, and not per render.