CLI Tool

The GoTranslate CLI is a powerful command-line interface for managing translations directly from your terminal.

Installation

npm install -g @gotranslate/cli

Authentication

Login with your API key:

gotranslate login

Common Commands

Initialize a Project

gotranslate init

Push Source Keys

Upload your translation keys to GoTranslate:

gotranslate push

Pull Translations

Download the latest translations:

gotranslate pull

Sync (Push + Pull)

gotranslate sync

Translation Status

Check completion status for all languages:

gotranslate status

Project Management

List Projects

gotranslate project:list

Create Project

gotranslate project:create "Project Name" --source=en --targets=ar,fr

Switch Project

gotranslate project:switch [project-id]

Translation Commands

Translate Text

gotranslate translate "Hello World" --to=ar

Add Translation Key

gotranslate key:add welcome.message "Welcome!" --context="Homepage greeting"

Configuration

View Config

gotranslate config:show

Set Config Value

gotranslate config:set translationPath ./i18n

CI/CD Integration

Use the CLI in your CI/CD pipeline:

# .github/workflows/translations.yml
name: Sync Translations
on:
  push:
    branches: [main]

jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm install -g @gotranslate/cli
      - run: gotranslate sync
        env:
          GOTRANSLATE_API_KEY: {{ secrets.GOTRANSLATE_API_KEY }}

Flags & Options

Most commands support these flags:

  • --verbose - Show detailed output
  • --json - Output in JSON format
  • --quiet - Suppress non-error output
  • --help - Show command help

Getting Help

gotranslate --help
gotranslate [command] --help