Skip to content

Commit 12ad0df

Browse files
authored
fix(cli): catalogsMergePath doesn't merge catalogs (#1341)
* fix(cli): catalogsMergePath doesn't merge catalogs * Add namespace and compilerBabelOptions to writeCompiled() call
1 parent 9248f9c commit 12ad0df

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

packages/cli/src/lingui-compile.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as plurals from "make-plural"
77

88
import { getConfig, LinguiConfig } from "@lingui/conf"
99

10-
import { getCatalogs } from "./api/catalog"
10+
import { getCatalogForMerge, getCatalogs } from "./api/catalog"
1111
import { createCompiledCatalog } from "./api/compile"
1212
import { helpRun } from "./api/help"
1313
import { getFormat } from "./api"
@@ -113,6 +113,23 @@ function command(config: LinguiConfig, options) {
113113
console.error(chalk.green(`${locale}${compiledPath}`))
114114
}
115115
})
116+
117+
if (doMerge) {
118+
const compileCatalog = getCatalogForMerge(config)
119+
const namespace = options.namespace || config.compileNamespace
120+
const compiledCatalog = createCompiledCatalog(locale, mergedCatalogs, {
121+
strict: false,
122+
namespace: namespace,
123+
pseudoLocale: config.pseudoLocale,
124+
compilerBabelOptions: config.compilerBabelOptions
125+
})
126+
const compiledPath = compileCatalog.writeCompiled(
127+
locale,
128+
compiledCatalog,
129+
namespace
130+
)
131+
options.verbose && console.log(chalk.green(`${locale}${compiledPath}`))
132+
}
116133
})
117134
return true
118135
}

0 commit comments

Comments
 (0)