comvi pull
The comvi pull command downloads translations from the Comvi platform and writes them to local JSON files. Use it to keep your local translation files in sync with the platform, generate static bundles for production, or seed translations for offline development.
Prerequisites
Section titled “Prerequisites”You need a .comvirc.json file in your project root and an API key. Prefer COMVI_API_KEY for the key:
{ "apiBaseUrl": "https://api.comvi.io", "translationsPath": "./src/locales", "fileTemplate": "{namespace}/{languageTag}.json", "format": "json"}Basic Usage
Section titled “Basic Usage”comvi pullThis downloads all languages and all namespaces from your project and writes them to the configured translationsPath.
Options
Section titled “Options”comvi pull [options]| Option | Alias | Default | Description |
|---|---|---|---|
--config | -c | .comvirc.json | Path to the Comvi config file |
--locale | -l | All project locales | Comma-separated list of locale tags to download |
--ns | -n | All namespaces | Comma-separated list of namespaces to download |
--path | -p | .comvirc.json → translationsPath | Output directory for translation files |
--empty-dir | .comvirc.json → pull.emptyDir | Clear the translations directory before writing files |
Output File Structure
Section titled “Output File Structure”Files are written per the configured fileTemplate. With the default template ({namespace}/{languageTag}.json), the default namespace is written at the root as {languageTag}.json, and every other namespace gets its own subdirectory:
src/locales/├── en.json # default namespace (root)├── de.json├── fr.json├── common/│ ├── en.json│ ├── de.json│ └── fr.json└── auth/ ├── en.json ├── de.json └── fr.jsonEach file contains the translation key-value pairs for that language and namespace:
{ "greeting": "Hello, {name}!", "nav.home": "Home", "nav.settings": "Settings"}The CLI writes JSON using the configured fileTemplate and format: "json". A custom template is matched literally.
{ "greeting": "Hello, {name}!", "nav": { "home": "Home", "settings": "Settings" }}Pulling Specific Locales
Section titled “Pulling Specific Locales”Download only the locales you need:
# Pull only English and Germancomvi pull --locale en,de
# Pull only Frenchcomvi pull -l frPulling Specific Namespaces
Section titled “Pulling Specific Namespaces”Download only certain namespaces:
# Pull only the common namespacecomvi pull --ns common
# Pull common and auth namespacescomvi pull -n common,authClearing the Local Directory
Section titled “Clearing the Local Directory”Use --empty-dir to wipe the translations directory before writing new files. This removes any local files that are no longer present on the platform:
comvi pull --empty-dirCI/CD Usage
Section titled “CI/CD Usage”Pull translations as part of your build pipeline so your production bundle always includes the latest translations:
name: Buildon: push: branches: [main]
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npx comvi pull env: COMVI_API_KEY: ${{ secrets.COMVI_API_KEY }} - run: npm run buildThis ensures that every build uses the most recent published translations without committing translation files to your repository.
Configuration File Reference
Section titled “Configuration File Reference”All pull options can also be set in .comvirc.json so you do not have to pass them every time:
{ "apiBaseUrl": "https://api.comvi.io", "translationsPath": "./src/locales", "fileTemplate": "{namespace}/{languageTag}.json", "format": "json", "pull": { "emptyDir": false }}Command-line flags override the config file values. For example, comvi pull --locale en pulls only English.
Next Steps
Section titled “Next Steps”- comvi push — upload local translations to the platform
- comvi typegen — generate TypeScript types from pulled translations
- CLI Overview — all CLI commands and global configuration
- CI/CD Integration — full pipeline examples