Skip to content

fix(cli): respect dev.usePseudotranslator config to skip API key validation #1983

@ShashwatpSingh

Description

@ShashwatpSingh

Bug Description

When dev.usePseudotranslator: true is set in i18n.json, the CLI still requires API keys to be configured. This should not happen - the pseudotranslator works entirely locally without any external APIs.

Current Behavior

// i18n.json
{
  "provider": "google",
  "dev": {
    "usePseudotranslator": true
  }
}

Running lingo.dev run still requires GOOGLE_API_KEY to be set, even though the pseudotranslator doesn't use it.

Root Cause

In packages/cli/src/cli/cmd/run/setup.ts:

const provider = ctx.flags.pseudo ? "pseudo" : ctx.config?.provider;

The CLI only checks for the --pseudo CLI flag. It does NOT check ctx.config?.dev?.usePseudotranslator.

The config-based pseudotranslator setting is only evaluated inside TranslationService, which is created after the localizer setup and API key validation.

Expected Behavior

When dev.usePseudotranslator: true is set in config, the CLI should:

  1. Skip API key validation
  2. Use the pseudo localizer (same as --pseudo flag)
  3. Work without any environment variables

Workaround

Use the --pseudo CLI flag instead:

lingo.dev run --pseudo

But this defeats the purpose of having the config option.

Proposed Fix

In setup.ts, also check the config:

const isPseudo = ctx.flags.pseudo || ctx.config?.dev?.usePseudotranslator;
const provider = isPseudo ? "pseudo" : ctx.config?.provider;

This ensures both the CLI flag and config option work identically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions