Skip to content

Commit

Permalink
fix: Report correct number of missing messages in strict mode (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
orangain committed Mar 1, 2021
1 parent 77ec0bd commit 128f3e2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/cli/src/lingui-compile.ts
Expand Up @@ -58,9 +58,12 @@ function command(config: LinguiConfig, options) {
)

if (!options.allowEmpty) {
const missing = R.values(messages)
const missingMsgIds = R.pipe(
R.pickBy(R.isNil),
R.keys,
)(messages)

if (missing.some(R.isNil)) {
if (missingMsgIds.length > 0) {
console.error(
chalk.red(
`Error: Failed to compile catalog for locale ${chalk.bold(
Expand All @@ -71,9 +74,9 @@ function command(config: LinguiConfig, options) {

if (options.verbose) {
console.error(chalk.red("Missing translations:"))
missing.forEach((msgId) => console.log(msgId))
missingMsgIds.forEach((msgId) => console.log(msgId))
} else {
console.error(chalk.red(`Missing ${missing.length} translation(s)`))
console.error(chalk.red(`Missing ${missingMsgIds.length} translation(s)`))
}
console.error()
process.exit(1)
Expand Down

1 comment on commit 128f3e2

@vercel
Copy link

@vercel vercel bot commented on 128f3e2 Mar 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.