Skip to content

Commit f8b90e2

Browse files
fix(cli): allow using PO formatter function with Translation.IO (#2375)
1 parent ef77310 commit f8b90e2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/cli/src/services/translationIO.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@ const getTargetLocales = (config: LinguiConfigNormalized) => {
4343
)
4444
}
4545

46+
const validCatalogFormat = (config: LinguiConfigNormalized): boolean => {
47+
if (typeof config.format === "string") {
48+
return config.format === "po"
49+
}
50+
return config.format.catalogExtension === ".po"
51+
}
52+
4653
// Main sync method, call "Init" or "Sync" depending on the project context
4754
export default async function syncProcess(
4855
config: LinguiConfigNormalized,
4956
options: CliExtractOptions
5057
) {
51-
if (config.format != "po") {
58+
if (!validCatalogFormat(config)) {
5259
console.error(
5360
`\n----------\nTranslation.io service is only compatible with the "po" format. Please update your Lingui configuration accordingly.\n----------`
5461
)

0 commit comments

Comments
 (0)