Skip to content

lingui compile --strict semantics do not match extract "Missing" #2506

@yslpn

Description

@yslpn

Description

There is an inconsistency between:

The CLI docs currently say that --strict will:

Fail if a catalog has missing translations.

At the same time, the config docs say that fallbackLocales are used when a translation for a locale is missing.

Today these two concepts do not line up clearly:

  • lingui extract reports Missing based on raw catalog entries with empty translations
  • lingui compile --strict appears to validate the resolved result after fallbacks are applied

Because of that, a locale can still show Missing > 0 in extract stats, while lingui compile --strict exits successfully.

This is especially confusing in CI for teams that:

  • use fallbackLocales at runtime
  • still want to fail builds until each locale catalog is fully translated

Related but distinct from #2195: that issue asks for a dedicated check command without writing files. This issue is about the current semantic mismatch between documented strict-mode behavior and what the CLI actually validates.

Verifications

  • I've checked the docs and this isn't covered there.
  • I've searched existing issues on GitHub.

Reproduction Steps

Documentation references:

lingui.config.js

export default {
  locales: ["en-US", "en-GB"],
  sourceLocale: "en-US",
  fallbackLocales: {
    default: "en-US",
  },
  catalogs: [
    {
      path: "<rootDir>/{locale}",
      include: ["<rootDir>"],
      exclude: [],
    },
  ],
}

en-US.po

msgid "Hello"
msgstr "Hello"

en-GB.po

msgid "Hello"
msgstr ""

Run:

lingui extract

Result:

Catalog statistics for {locale}:
┌────────────────┬─────────────┬─────────┐
│ Language       │ Total count │ Missing │
├────────────────┼─────────────┼─────────┤
│ en-US (source) │      1      │    -    │
│ en-GB          │      1      │    1    │
└────────────────┴─────────────┴─────────┘

Then run:

lingui compile --strict

Current result:

Compiling message catalogs…
Done in <n>ms

The process exits with code 0.

Expected Behavior

The current behavior should be clarified or changed so that the semantics are consistent.

One of these should happen:

  1. lingui compile --strict should fail when locale catalogs still contain raw missing translations, matching the Missing counts reported by lingui extract.
  2. If lingui compile --strict is intentionally defined as "fail only after fallback resolution", the docs should say that explicitly, because the current --strict wording reads much broader.

Without that clarification, extract and compile --strict suggest different answers to the question "does this locale still have missing translations?"

Macro Support

Not using macro

Lingui Version

@lingui/cli 6.0.0-next.3 (current repository state)

Babel Version

N/A

Framework

CLI only / no framework

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions