Convert i18n.json
How lingo migrate turns a CLI v0 i18n.json into .lingo/config.json, and what to do when a repository has several.
Convert i18n.json #
lingo migrate writes .lingo/config.json beside i18n.json, prints the settings it could not convert, and changes no other file. It needs CLI 1.25.0 or newer and no network. If .lingo/config.json already has localization settings, --force replaces them and keeps the IDs lingo link saved. This section describes the conversion, so you can check its result or write the config by hand. This v0 config:
{
"version": "1.15",
"locale": { "source": "en", "targets": ["de", "fr", "pt-BR"] },
"buckets": {
"json": {
"include": ["locales/[locale].json"],
"lockedKeys": ["brand/name"]
},
"markdown": { "include": ["docs/[locale]/**/*.md"] },
"yaml-root-key": { "include": ["config/locales/[locale].yml"] }
}
}becomes:
{
"sourceLocale": "en",
"targetLocales": ["de", "fr", "pt-BR"],
"files": [
{ "pattern": "locales/en.json", "lockedKeys": ["brand.name"] },
{ "pattern": "docs/en/**/*.md" },
{ "pattern": "config/locales/en.yml", "format": "yaml-root-key" }
]
}Each bucket path becomes one files entry: pattern for one path, or include for several. Patterns name the source file, so [locale] becomes the source locale.
The CLI derives each target path by swapping the locale, so locales/en.json gives locales/de.json. If the source path does not contain the locale, set targetPath, except for .xcstrings and CSV files, which keep every locale in the source file. lingo migrate checks every path, and every project file it matches, against the paths v0 wrote for each target locale. It adds localeFormat or targetPath where derivation alone would write elsewhere, and lists a path that neither can express and any folder it could not read.
Patterns match with * and ** only. lingo migrate writes a path with {a,b} once per alternative, lists one with ? or brackets, and leaves out a bucket whose exclude has them. Under a pattern with a ** segment v0 skipped dist, build, .next and .turbo folders, so it adds them to exclude.
Remove every other v0 field: the CLI warns about unknown fields and ignores them, and the GitHub App rejects the config.
Several i18n.json files #
Each folder that holds an i18n.json becomes its own project with its own .lingo/config.json. Run lingo migrate, lingo link and the first push in each of those folders, and in CI run lingo push --wait from each folder. The GitHub App reads only the .lingo/config.json at the repository root, so a repository with a config per package stays on the CLI: follow CLI in your pipeline.
Back to Migration reference.