locinai
v1.0.0
Published
LocIn CLI — scan your codebase for translatable strings, set up i18next, and sync translations with the LocIn localization platform.
Downloads
140
Maintainers
Readme
locin
The LocIn CLI scans your codebase for translatable strings, sets up i18next, and syncs translations with the LocIn platform.
locin detects untranslated strings, scaffolds i18next, extracts keys into locale resource files, and uploads, translates, exports, and validates translations against the LocIn backend at https://api.locin.dev.
Requirements
- Node.js >= 20
Installation
Install globally from npm:
npm install -g locinaiThis installs two equivalent commands on your PATH — use whichever you prefer:
locin # short form
locinai # same commandRun with no arguments to open the interactive command picker:
locinAuthentication
Interactive (local development)
locin auth login runs an OAuth-style device flow: it opens a browser to a verification URL and polls until you approve access. Tokens are cached at ~/.locin/auth.json and refreshed automatically.
locin auth login
locin auth status
locin auth logoutHeadless / CI
Provide an API key (starting with lk_) via environment variable, or pass a token directly:
export LOCIN_API_KEY=lk_xxx
# or
locin <command> --token <jwt-or-lk_key>Commands
| Command | Description |
| --- | --- |
| help | Show help. |
| flow | Run the i18n pipeline (detect/setup/extract, optional upload/translate/export/validate). |
| init | Create or update .locin-cli.json in the repo root. |
| scan | List files in the repo. |
| analyze | Detect i18next and scan for untranslated strings. |
| extract | Generate a locale resource file from discovered i18n keys. |
| auth | Authenticate the CLI (login/logout/status). |
| project | Manage projects (list/create/delete/switch/info). |
| upload | Upload files to the API. |
| translate | Start a translation batch for a project. |
| export | Export files from the API and sync locale files. |
| validate | Validate translations: coverage, placeholders, HTML, length. |
| completion | Generate shell completion. |
flow
Runs the i18n pipeline. Individual step failures do not stop the pipeline.
--full,--all— run the entire pipeline: scan → setup → extract → upload → translate → export → validate.
init
Creates or updates .locin-cli.json in the repo root.
--reset— reset configuration to defaults.
analyze
Detects i18next and scans for untranslated strings.
--fix— autofix safe findings.--deep,--deep-scan— run a server-classified Pass 2 (requires Pro plan +projectId+ auth).--accept-cloud-classifier— grant and persist cloud-classifier consent.
extract
Generates a locale resource file from discovered i18n keys.
--out <path>— output path.--map— force key-map usage.
project
Manage projects (list/create/delete/switch/info).
--name <name>— name forcreate.--project <ref>— project reference forswitch/info/delete.
upload
Uploads files to the API.
--source <lang>— source language (defaulten).
translate
Starts a translation batch for a project.
--languages <codes>— target language codes.--files <names>— files to translate.--wait,-w— poll until the job completes.--timeout <seconds>— poll timeout (0= unlimited).
export
Exports files from the API and syncs locale files.
--languages <codes>— language codes.--locale <code>— single-language alias.--files <names>— files to export.
validate
Validates translations for coverage, placeholders, HTML, and length.
--min-coverage <n>— minimum coverage percent (default100).--languages <codes>— language codes.
completion
Generate shell completion:
locin completion --shell <bash|zsh|fish> [--name <name>]Global flags
| Flag | Description |
| --- | --- |
| --version, -V | Print the CLI version. |
| --interactive, -i | Force interactive mode. |
| --json | Emit structured JSON to stdout; human-readable text to stderr. |
| --ci | Implies --json, disables prompts, fails on missing args. |
| --token <token> | Auth token (JWT or lk_ key). |
| --api-base-url <url> | Override the API base URL. |
| --scope <path> | Limit file operations to a subfolder. |
| --debug | Write eligibility/auth/entitlement debug logs to stderr (also LOCIN_DEBUG=1). |
Project selection
The active project is resolved in this order:
--project-id <id>flag.locin-cli.jsonconfigLOCIN_PROJECT_IDenvironment variable- Interactive prompt
Environment variables
| Variable | Description |
| --- | --- |
| LOCIN_API_BASE_URL | Override the API base URL (default https://api.locin.dev). |
| LOCIN_API_KEY | API key (lk_...) for headless/CI auth. |
| LOCIN_PROJECT_ID | Default project ID. |
| LOCIN_LANGUAGES | Default target languages. |
| LOCIN_SOURCE_LANGUAGE | Default source language. |
| LOCIN_DEBUG=1 | Enable debug logs. |
| LOCIN_HTTP_TIMEOUT_MS | HTTP timeout in milliseconds (default 20000). |
Example workflow
# 1. Authenticate
locin auth login
# 2. Scaffold config and detect i18next
locin init
locin analyze --fix
# 3. Extract keys into a locale resource file
locin extract --out ./locales/en.json
# 4. Upload, translate, and sync back
locin upload --source en
locin translate --languages fr,de --wait
locin export --languages fr,de
# 5. Validate coverage
locin validate --languages fr,de --min-coverage 95CI/CD examples
# Run a translation batch and wait for completion
LOCIN_API_KEY=lk_xxx locin translate --project-id 42 --languages en,fr --ci --wait
# Run the full pipeline end to end
LOCIN_API_KEY=lk_xxx locin flow --full --project-id 42 --languages en,fr --yes --ci
# Validate translation coverage as a build gate
locin validate --languages tr,de,fr --min-coverage 95 --ciExit codes
| Code | Meaning |
| --- | --- |
| 0 | Success. |
| 1 | General error. |
| 2 | Authentication failure. |
| 3 | Validation error or missing required argument. |
Notes
- Commands run against the nearest parent folder containing a
package.json. - In non-TTY environments, interactive prompts are skipped.
License
Proprietary — UNLICENSED. All rights reserved.
