sync
Pull translations and generate types in one step (default command).
Pulls the source locale and generates the typed .d.ts in one step. This is the
default command — lb with no command runs sync.
lb sync --project my-app
lb sync --project my-app --out src/@types/resources.d.tsOptions
| Flag | Default | Notes |
|---|---|---|
-o, --out <path> | src/@types/resources.d.ts | Output .d.ts path. |
--no-params | — | Keys only; skip TranslationParams. |
--keep-json | off | Also write the raw JSON to --json-dir. |
Plus the common options. Equivalent to
pull + generate.
Example output
For a common namespace with welcome: "Welcome" and
greeting: "Hi {{name}}", sync writes:
// Generated by @language-bridge/cli — do not edit.
// Source locale: en. Re-run `lb sync` to update.
/* eslint-disable */
export interface Resources {
"common": {
"greeting": string;
"welcome": string;
};
}
export type TranslationParams = {
"common:greeting": { "name": string | number };
"common:welcome": {};
};
declare module "i18next" {
interface CustomTypeOptions {
defaultNS: "common";
resources: Resources;
}
}Resources types the keys, TranslationParams types interpolation params (empty
{} = no params). --no-params skips the TranslationParams block. Now wire it
into i18next — see Typed i18next.