On this page
Versions and publishing
A version is a set of values of its own, with its languages and namespaces; your app chooses one with the version option. Publishing writes a version's values as files to the CDN, so which version your app loads, and the shape of its files, decide what your users read.
Versions
Every project starts with the version latest. Two patterns cover most projects:
- Stages:
latestfor development and a version such asproductionfor what your users see. When a stage is ready, you move its content on to the next one. - One version per release of an app whose users update when they choose, such as a mobile app: each release loads its own version, so a change for the next release never reaches the one already out. A bugfix release can keep its version.
Avoid a version per build or per date: each one is a full copy that you have to keep or delete.
A version you add has your languages but no keys. Overwriting it from another version gives it that version's languages, namespaces and keys; its own publish settings stay.
i18next.use(LocizeBackend).init({
backend: {
projectId: '<project-id>',
version: 'production'
}
})Overwrite or copy
There are two ways to move content from one version into another:
- Overwrite makes the target a 1:1 copy of the source, free of charge: keys and namespaces the source lacks are removed from the target. The overwrite publishes the target when you keep Publish after overwriting on, which is the default, or when the target publishes automatically. Every tenant's version gets the copy, but a tenant publishes it only if its version publishes automatically.
locize copy-versionmakes the same copy from your CI and publishes only a target that publishes automatically. - Copy takes only new and changed values and counts them as modifications. It can be limited to some languages and namespaces, can update existing keys only or remove the keys the source lacks, and leaves the changes unsaved in the editor, so you review them before they are stored.
Overwrite when the source is the state you want to release; copy when the target has values of its own that must stay. Overwriting needs the admin, manager or publisher role.
Publishing
A version publishes automatically on every saved change, or only when you publish it; a version can also publish privately, so its files need an API key. How each works, and from where you publish: publishing on the CDN and private versions. How long a published change takes to reach your users: caching.
Publish format
Keys with dots, such as login.label, can be published as nested JSON or kept flat. The project's publish format decides, for every version:
| Format | The published file |
|---|---|
| json (auto), the default | nested, unless one of the keys below needs a flat file |
| json nested | always nested; a key that cannot be nested is lost |
| json flat | always flat, every key as it is |
When a file is flat
With json (auto), a single key makes the whole file of its language and namespace flat:
- a key with a space, a comma or a question mark, such as
User not found!; - a key below another key's value, such as
buttonnext tobutton.tooltip:buttoncannot be a text and an object at once; - a key that nesting would lose, such as
Saved.(ending with a dot),errors..requiredoroffset.-1.
To get nested files, keep keys technical and dot separated. To always get the same shape, choose json flat.
When numbers become arrays
A key part made only of digits becomes an array index when the file is nested, so colors.0, colors.1 and colors.2 publish as an array.
An array gets null where an index is missing:
{ "steps.0": "Start", "steps.2": "Finish" }publishes as
{ "steps": ["Start", null, "Finish"] }Number your keys without gaps, or start them with a letter, such as step1, to get an object.
Empty values
An empty value is left out of the published file and counts as untranslated, unless you choose to publish empty values, either still counting as untranslated or counting as translated.
Earlier published files
On the Pro CDN, every published file keeps its earlier states for 30 days after they were replaced: for a language and namespace you can open or download each one. To get whole namespaces back into Locize, use backups; the history of a single key is in the editor.
Versions or workspaces?
A version is a stage or a release your app loads; a workspace is a copy of the project for changes you merge back later: see versions or workspaces.