Published JSON format
A published file is plain i18next JSON. Nothing about it is proprietary: if you stopped using localize.work tomorrow, these files are already the format your i18next app wants.
Every example on this page is produced at documentation build time by running the real publish renderer over the inputs shown, so the output is literal, not illustrative.
One file per (locale, namespace)
Section titled “One file per (locale, namespace)”The renderer takes every published row for one locale and namespace and produces
one file at
{cdnBaseUrl}/{projectSlug}/{version}/{locale}/{namespace}.json.
Rows in the editor:
| Key | Plural form | Value |
|---|---|---|
greeting | — | Hello |
actions.delete | — | Delete |
docs.count | one | {{count}} doc |
docs.count | other | {{count}} docs |
Published file:
{ "actions": { "delete": "Delete" }, "docs": { "count_one": "{{count}} doc", "count_other": "{{count}} docs" }, "greeting": "Hello"}Three rules do all the work:
- Dots nest.
actions.deletebecomes{ actions: { delete: … } }. - Plural forms suffix the leaf, not the path:
docs.countwith formonebecomesdocs.count_one, neverdocs.one.count. - Keys are sorted, and the file is pretty-printed with two-space indentation. Publishing the same content twice byte-for-byte produces the same file.
Interpolation is untouched — {{count}} is just text as far as publishing
is concerned.
What is in a file
Section titled “What is in a file”- Only rows whose status is
reviewedat publish time, overlaid on the previously active release’s contents. - For variant locales, only non-empty values. Variant files are sparse and may not exist at all; see variant locales.
- For base locales, an empty string publishes as an empty string. It is a value.
Conflict rules
Section titled “Conflict rules”Two different keys can legitimately render to the same place — the database
allows a key named a and a key named a.b to coexist. The renderer resolves
this deterministically, never throws, and emits a publish warning so the
collision is visible in the logs.
A text where an object is needed: the deeper key goes to the top level
Section titled “A text where an object is needed: the deeper key goes to the top level”Keys a = "shallow" and a.b = "deep". Nested JSON cannot hold both at
a, so a keeps its place and a.b is written at the top level of the file
under its full dotted name:
{ "a": "shallow", "a.b": "deep"}key "a.b" runs through text key "a" — written under its dotted name
i18next finds a.b there because it looks up the full key name when the
nested path does not lead to a value (ignoreJSONStructure, on by default
since i18next 20). Both values reach your app, so projects imported from flat
Locize-style files, where a and a.b often coexist, keep every text. The
result is the same regardless of the order the rows arrive in.
The rule looks at the namespace in every locale of the release, not only
the file being written. If en has a and de has only a.b, the de file
still writes a.b at the top level rather than as { "a": { "b": … } }.
Otherwise i18next would find that object for a in de and return it,
instead of falling back to the en text. The same holds for variant locales
such as en-FI, whose files contain only their overrides. A plural key counts
as a text at its own name: next to a plural items (items_one,
items_other), the key items.title is written at the top level in every
locale, so a locale without the plural still falls back for items.
Two narrower consequences:
- Empty text. i18next skips an empty value when it checks the whole key
name, so an empty
a.b.cunder a texta.bis written next to that text, as{ "a": { "b": "…", "b.c": "" } }, where i18next joins the remaining segments. i18next 23.8.2 and later find it there. Earlier versions (including 21, 22 and 23.0 to 23.8.1) do not when the texta.bis in the same file: they fall back to the next language instead of showing the empty text. - Groups. Keys below a text are written one by one, so with a text
aand a keya.z.y,t('a.z', { returnObjects: true })does not return{ "y": … }. Because the rule spans every locale, this also holds in a language that lacks the text itself: with a texta.binen,de’st('a', { returnObjects: true })leaves outde’sa.b.c. Look such keys up individually. - Repeated segment names before i18next 23.8.0. When a key written at the
top level is also the end of a longer key (
b.bandb.b.b,x.yandx.y.x.y), i18next before 23.8.0 (including 21, 22 and 23.0 to 23.7) can return the shorter key’s text for the longer one in a file that lacks the longer key, instead of falling back to the next language. 23.8.0 and later are not affected. - Properties of a text before i18next 23.8.0. In a fallback chain, a
language whose file has a key written at the top level (
form.password) can answer a longer key below it (form.password.0,form.password.length) with a character or the length of that text, instead of falling back to the next language. i18next before 23.8.0 (including 21, 22 and 23.0 to 23.7) does this; 23.8.0 and later are not affected. saveMissingunder a text. WithsaveMissingon, i18next writes each missing key into its in-memory copy of the texts along the key’s dotted path. Where keys sit under a text, that write can replace or hide published texts in memory, including keys written at the top level, until the page reloads, in every i18next version; before 23.8.2 it can also throw fromt(). Published files are not affected; see saveMissing.
Two keys rendering to one leaf: sorted order, last wins
Section titled “Two keys rendering to one leaf: sorted order, last wins”A plain key literally named items_one next to a plural key items with form
one both want the leaf items_one. Keys are processed in sorted order, so
items (plural) is written first and the plain items_one overwrites it:
{ "items_one": "plain key that looks plural"}key "items_one" renders to an already-used name — previous value dropped
Edge cases that are kept literally
Section titled “Edge cases that are kept literally”Leading, trailing and doubled dots produce empty path segments, and they are
kept as-is rather than normalised — .leading renders as an object with an
empty-string property. The renderer builds prototype-less objects, so a legacy
key named __proto__ cannot poison anything. New keys arriving through import
or saveMissing reject __proto__, prototype and constructor segments
outright.
Stability
Section titled “Stability”A version path is immutable. Once v12/en/common.json exists, it is never
rewritten — not by a later publish, not by a rollback, not by renaming or
deleting the key. Releases store key and namespace names, so a published
release keeps rendering the same bytes even after the underlying rows change
shape.
That is what makes Cache-Control: max-age=31536000, immutable honest on those
paths.