From bfb3723e7034cade3e01ee548d104555425471e4 Mon Sep 17 00:00:00 2001 From: Leo Bernard Date: Thu, 11 Jan 2024 14:36:45 +0100 Subject: [PATCH] :bug: Fix `--with-arrays` producing objects instead of arrays in output files --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index fca8237..a7f0280 100644 --- a/src/index.ts +++ b/src/index.ts @@ -277,6 +277,7 @@ const translate = async ( workingDir, dirStructure, deleteUnusedStrings, + withArrays, ); switch (dirStructure) { @@ -421,6 +422,7 @@ function createTranslator( workingDir: string, dirStructure: DirectoryStructure, deleteUnusedStrings: boolean, + withArrays: boolean, ) { return async ( sourceFile: TranslatableFile, @@ -482,7 +484,7 @@ function createTranslator( const newContent = JSON.stringify( sourceFile.type === 'key-based' - ? unflatten(translatedFile, { object: true }) + ? unflatten(translatedFile, { object: !withArrays }) : translatedFile, null, 2,