Project sync
Pin a repository to LangSync with nrc langsync init, then reconcile local JSON translation files with sync and pull — flags, conflict strategies, and the .langsync.json reference.
Project sync keeps translation files in your Git repository and
LangSync in agreement. You initialise a project once
(nrc langsync init), which writes a .langsync.json config; from
then on nrc langsync sync pushes local changes and pulls back the
complete, AI-completed state, and nrc langsync pull refreshes local
files without pushing anything.
Initialise a project
Run in the project root:
nrc langsync initThe wizard resolves your organization, lists its namespaces, lets you
pick one or more (or create one inline if none exist), asks where each
namespace's translation files should live (default i18n/<namespace>),
and fetches each namespace's default language. Then it runs a seed
pass for the newly added namespaces.
Non-interactive / scripted setup:
nrc langsync init -n web -n marketing --dir i18n --seed pull| Flag | What it does |
|---|---|
--namespace, -n (repeatable) | Namespaces to include, skipping the picker. |
--dir | Parent directory for translation files; each namespace gets <dir>/<namespace>. |
--local-lang | The language code you write source values in (defaults to the namespace's server default — see source language). |
--seed | What to do right after writing the config: pull (default — download server state), push-all (upload every local <lang>.json as the seed), push-default (upload only the default-language file and AI-translate the rest), none. |
--force | Overwrite an existing .langsync.json instead of merging into it. |
Re-run init any time to add another namespace — existing entries are
kept, and the seed pass touches only what's new.
The .langsync.json file
init writes this at the project root; commit it.
{
"version": 1,
"organization": {
"id": "6a4c1f0e-…",
"slug": "acme",
"name": "Acme Corp"
},
"namespaces": [
{
"namespace": "web",
"dir": "i18n/web",
"format": "flat-json",
"default_local_language": "en",
"context_file": "i18n/web/context/en.json",
"language_aliases": { "cs_cz": "cs-CZ" }
}
]
}| Field | Meaning |
|---|---|
version | Config format version (currently 1). A newer version than your CLI supports asks you to norcube upgrade. |
organization | Pins the project to one org. Every langsync command run inside this tree targets this org regardless of your profile's organization; --org and NORCUBE_ORG still override for debugging. |
namespaces[].namespace | The namespace name (case-sensitive) — what --namespace refers to. |
namespaces[].dir | Directory of translation files, relative to the config file (not your cwd), one <lang-code>.json per language. |
namespaces[].format | Only flat-json exists today. |
namespaces[].default_local_language | The language your local source values are written in. |
namespaces[].context_file | Optional. A JSON file of key descriptions in your source language, resolved like dir. See Key descriptions. |
namespaces[].language_aliases | Maps on-disk filename codes to server codes (e.g. cs_cz.json ↔ server cs-CZ). Maintained automatically by sync. |
Translation file format
flat-json files are plain one-level string maps, one file per
language inside the namespace dir:
i18n/web/
├── en.json
├── de.json
└── cs.json{
"button.save": "Save",
"welcome.title": "Welcome"
}Rules the CLI enforces and guarantees:
- Strings only, no nesting. Nested objects, arrays, or numbers are rejected rather than silently mangled.
- Keys are written sorted with two-space indent and a trailing newline, and files are written atomically — so post-sync Git diffs are minimal and reviewable.
- Empty strings are preserved as empty translations.
- Dotfiles and subdirectories in the dir are ignored.
Key descriptions (context_file)
A short key such as close or changes can mean several things, and
so can its English text. A description of where the text is used helps
the AI pick the right word. Keep the descriptions next to your strings
in a flat JSON file, written in your source language:
{
"dialog.close": "Button that closes the dialog without saving",
"nav.changes": "Menu item that opens the list of unpublished changes"
}Point the namespace's context_file at it. Every nrc langsync sync
then reads the file and sends the descriptions with the sync; no flag
is needed. The server stores them as the terms' context (the
Context field in the dashboard), and the AI gets each key's
description whenever it translates the key. See
Sync jobs for how the
server applies them.
Each of these is an error:
- the file is missing (the error names the path);
- it is not valid JSON, or a value is not a string (the error names the path);
- it is a
.jsonfile directly in the namespace'sdir, because the CLI reads every*.jsonthere as a language. Keep it in a subdirectory, such asi18n/web/context/en.json; subdirectories are skipped when the CLI looks for language files; - a description is longer than 1,000 characters (the error names the key).
An entry for a key your source file doesn't have is left out with a
warning. A key that is not in the file keeps the description it has
on the server.
Reading context_file needs a current CLI release (norcube upgrade).
Sync
nrc langsync sync # everything in .langsync.json
nrc langsync sync -n web # one namespace
nrc langsync sync --dry-run # plan only — see the diff, change nothingEach namespace gets its own sync job; jobs run in parallel with a live per-namespace dashboard showing the current phase and progress. After the server finishes (push + AI translation of missing cells), the CLI writes the complete per-language state back to your local files. Failures appear in an Issues block with hints — the most common being source values that are empty, which the AI skips.
The summary also lists:
- Keys whose translation was not stored, each with its language and
code. Either the AI's answer failed the checks (
placeholders_changed,plural_forms,untranslated, …) and the translation stays empty until the next sync tries again or someone translates it, or, in anicunamespace, a value you pushed is not a valid message and the server keeps what it had. ICU messages explains every code. - Unreviewed translations per language: how many translations have text that nobody has marked reviewed yet.
| Flag | Default | What it does |
|---|---|---|
--dry-run | off | Stop after planning; print the would-be creates/updates/deletes. |
--strategy | local | Conflict policy — see below. |
--prune | off | Delete server marks that don't exist locally. Permanent; dry-run first. |
--retranslate-on-source-change | off | When a source value changed, clear that term's other-language translations so the AI regenerates them. Off = stale translations stay. |
--wait / --wait-timeout / --poll-every | on / 5m / 1s | Whether and how long to wait for AI translation to finish before writing files and returning. --wait=false returns right after the push; run pull later for the rest. |
--config | auto | Path to .langsync.json (default: walk up from the current directory). |
Conflict strategies
A conflict is the same key having different values locally and on the server (someone edited in the dashboard while you edited in Git):
local(default) — your value wins and is pushed.server— nothing is pushed at all; the sync becomes a pull-only refresh.interactive— the CLI walks you through each conflicting key with keep-local / keep-server choices and apply-to-all shortcuts.
Conflicts are only negotiated for the source language. For target languages, your local edits always win — a hand-fixed translation in your repo is treated as authoritative over whatever the server has.
Deletions
By default, sync is conservative: marks that exist on the server but
not in your local files are left alone (maybe a teammate just added
them in the dashboard). --prune inverts this — the local file set
becomes authoritative and server-only marks are deleted, translations
and all. --dry-run --prune shows what would go.
Language attachment pre-flight
Before pushing, sync looks at which <code>.json files exist locally
and makes sure each language is attached to the namespace:
- exact code match → attached silently;
- separator-only or single obvious candidate (
cs_cz.json→cs-CZ) → attached silently and recorded inlanguage_aliases; - ambiguous or unknown → interactive picker (with an option to create a custom language, or to skip the file).
Dropping a new pl.json into the directory and running sync is all
it takes to add Polish to the namespace.
Pull
nrc langsync pull # refresh all namespaces from the server
nrc langsync pull -n webpull downloads the current server state into your local files and
never modifies the server — no push, no AI translation triggered.
Use it to pick up dashboard edits, or to collect translations that were
still draining when a --wait=false sync returned.
Your source language vs. the namespace's
default_local_language doesn't have to match the namespace's default
language. A Czech developer on a namespace pinned to en-US can set
default_local_language: "cs", write source strings in cs.json, and
sync — the server then AI-translates from Czech into every attached
language, English included. Each developer's config can differ; the
setting is per-project-file, not per-namespace.
CI usage
Everything works headless — pickers are replaced by flags and
confirmations by --yes:
# after merging to main
- run: nrc langsync sync --strategy local --wait=falseWith -o json the dashboard is left out and stdout gets one summary per
namespace (namespace, status, created, updated, deleted,
stillUntranslated, filesWritten, error), also when a namespace
failed, so a pipeline can report exactly what changed:
nrc langsync sync -o json --query "[?status=='failed'].namespace"Authenticate the job with a CI token
that has the langsync.sync scope, stored as the secret NORCUBE_TOKEN.
It belongs to the organization, not to a person, so it keeps working when
team members change, and the organization in .langsync.json must be
that organization (a mismatch fails instead of syncing elsewhere):
# GitHub Actions
- uses: norcubeplatform/setup-norcube@v1
with:
token: ${{ secrets.NORCUBE_TOKEN }}
- run: nrc langsync sync --strategy local --wait=false# create the token once, with your own login
nrc auth ci-token create --name "translations CI" --scopes langsync.sync -o text | gh secret set NORCUBE_TOKENThe CLI guide has a GitLab CI example. CI tokens need CLI 0.18 or later.
A typical CI policy: sync on merge to main (push new source strings,
kick off AI translation, don't block the pipeline waiting for it), and
a scheduled pull job — or a pre-release one — that commits refreshed
translation files back to the repo for review.
Related
- Sync jobs — the server-side lifecycle, statuses, and guarantees behind every sync.
- CLI overview — resource commands and org resolution.
CLI
Manage LangSync from the terminal with norcube / nrc. Namespaces, terms, translations, languages, prompts, the glossary, API keys, CSV import, the audit log and project sync.
Audit log
Every sensitive LangSync action in your organization — who did what, when, and to which resource, with filters for investigation.