Command Line Interface

Locsy CLI

Streamline your translation workflow with our powerful command-line interface. Perfect for CI/CD pipelines and automated deployments.

Quick Start
Get up and running with the Locsy CLI in minutes

1. Install the CLI

npm install -g @locsy/cli

2. Login to your account

locsy login

3. Start translating

locsy translate en.json --to es,fr,de

Command Reference

Authentication Commands
Manage your authentication with the Locsy service

locsy login

Authenticate with your Locsy account

locsy login [--api-key YOUR_API_KEY]
Options:
  • --api-key: Use API key authentication instead of browser login
  • Alternatively, set LOCSY_API_KEY environment variable

locsy logout

Remove stored authentication credentials

locsy logout

locsy whoami

Display current user information

locsy whoami

CI/CD Integration

GitHub Actions
name: Locsy Translation
on:
  push:
    branches: [main]
    paths: ['src/locales/en.json']

jobs:
  translate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '18'
      
      - name: Install Locsy CLI
        run: npm install -g @locsy/cli
      
      - name: Translate files
        env:
          LOCSY_API_KEY: ${{ secrets.LOCSY_API_KEY }}
          LOCSY_PROJECT: ${{ secrets.LOCSY_PROJECT }}
        run: |
          locsy translate src/locales/en.json \
            --to es,fr,de \
            --project $LOCSY_PROJECT
        
      - name: Commit translations
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add src/locales/
          git commit -m "Update translations" || exit 0
          git push
Configuration File

Create a .locsyrc.json file to set project defaults:

{
  "project": "my-app-project-id",
  "defaultLanguages": ["es", "fr", "de"],
  "sourceFile": "src/locales/en.json",
  "outputDir": "src/locales",
  "format": "nested",
  "glossary": true,
  "context": "Web application UI"
}

Environment Variables:

# Set API key via environment variable
export LOCSY_API_KEY="your-api-key-here"

# Optional: Set default project
export LOCSY_PROJECT="your-project-id"

CLI Features

Lightning Fast
Optimized for speed with parallel processing and caching
Batch Operations
Process multiple files and languages simultaneously
Pipeline Ready
Built for CI/CD with proper exit codes and JSON output

Ready to automate your translations?

Install the Locsy CLI today and streamline your localization workflow