From 7a7048930f4245e50778f28144ace9753915e0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Chr=C3=A1stek?= Date: Mon, 16 Jan 2023 15:03:10 +0100 Subject: [PATCH 1/2] fix(cli): catalogsMergePath doesn't merge catalogs --- packages/cli/src/lingui-compile.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/lingui-compile.ts b/packages/cli/src/lingui-compile.ts index 4c4febe78..7579741db 100644 --- a/packages/cli/src/lingui-compile.ts +++ b/packages/cli/src/lingui-compile.ts @@ -7,7 +7,7 @@ import * as plurals from "make-plural" import { getConfig, LinguiConfig } from "@lingui/conf" -import { getCatalogs } from "./api/catalog" +import { getCatalogForMerge, getCatalogs } from "./api/catalog" import { createCompiledCatalog } from "./api/compile" import { helpRun } from "./api/help" import { getFormat } from "./api" @@ -113,6 +113,17 @@ function command(config: LinguiConfig, options) { console.error(chalk.green(`${locale} ⇒ ${compiledPath}`)) } }) + + if (doMerge) { + const compileCatalog = getCatalogForMerge(config) + const compiledCatalog = createCompiledCatalog(locale, mergedCatalogs, { + strict: false, + namespace: options.namespace || config.compileNamespace, + pseudoLocale: config.pseudoLocale, + }) + const compiledPath = compileCatalog.writeCompiled(locale, compiledCatalog) + options.verbose && console.log(chalk.green(`${locale} ⇒ ${compiledPath}`)) + } }) return true } From 19166f8aebb6f3f559cbf5ffc0d999e5a6234b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Chr=C3=A1stek?= Date: Mon, 16 Jan 2023 20:46:27 +0100 Subject: [PATCH 2/2] Add namespace and compilerBabelOptions to writeCompiled() call --- packages/cli/src/lingui-compile.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/lingui-compile.ts b/packages/cli/src/lingui-compile.ts index 7579741db..86518ea68 100644 --- a/packages/cli/src/lingui-compile.ts +++ b/packages/cli/src/lingui-compile.ts @@ -116,12 +116,18 @@ function command(config: LinguiConfig, options) { if (doMerge) { const compileCatalog = getCatalogForMerge(config) + const namespace = options.namespace || config.compileNamespace const compiledCatalog = createCompiledCatalog(locale, mergedCatalogs, { strict: false, - namespace: options.namespace || config.compileNamespace, + namespace: namespace, pseudoLocale: config.pseudoLocale, + compilerBabelOptions: config.compilerBabelOptions }) - const compiledPath = compileCatalog.writeCompiled(locale, compiledCatalog) + const compiledPath = compileCatalog.writeCompiled( + locale, + compiledCatalog, + namespace + ) options.verbose && console.log(chalk.green(`${locale} ⇒ ${compiledPath}`)) } })