@@ -209,6 +209,7 @@ const logSection = (
209209}
210210
211211const processLocale = async (
212+ singleLocale : boolean ,
212213 localeFile : string ,
213214 referenceContent : NestedObject ,
214215 fix = false ,
@@ -220,7 +221,7 @@ const processLocale = async (
220221 // - language locale files at countries allowed: e.g. es.json
221222 // - country locale file forbidden: e.g. es-ES.json
222223 // - target locale file forbidden: e.g. es-419.json
223- if ( fix && localeInfo . mergeLocale ) {
224+ if ( fix && localeInfo . mergeLocale && singleLocale ) {
224225 console . error (
225226 `${ COLORS . red } Error: Locale "${ localeInfo . locale } " cannot be fixed, fix the ${ localeInfo . lang } locale instead!.${ COLORS . reset } ` ,
226227 )
@@ -238,7 +239,7 @@ const processLocale = async (
238239 const newContent = syncLocaleData ( referenceContent , targetContent , stats , fix )
239240
240241 // Write if there are removals (always) or we are in fix mode
241- if ( stats . extra . length > 0 || fix ) {
242+ if ( ! localeInfo . mergeLocale && ( stats . extra . length > 0 || fix ) ) {
242243 writeFileSync ( filePath , JSON . stringify ( newContent , null , 2 ) + '\n' , 'utf-8' )
243244 }
244245
@@ -258,7 +259,12 @@ const runSingleLocale = async (
258259 process . exit ( 1 )
259260 }
260261
261- const { missing, extra, referenceKeys } = await processLocale ( localeFile , referenceContent , fix )
262+ const { missing, extra, referenceKeys } = await processLocale (
263+ true ,
264+ localeFile ,
265+ referenceContent ,
266+ fix ,
267+ )
262268
263269 console . log (
264270 `${ COLORS . cyan } === Missing keys for ${ localeFile } ${ fix ? ' (with --fix)' : '' } ===${ COLORS . reset } ` ,
@@ -298,7 +304,7 @@ const runAllLocales = async (referenceContent: NestedObject, fix = false): Promi
298304 let totalAdded = 0
299305
300306 for ( const localeFile of localeFiles ) {
301- const stats = await processLocale ( localeFile , referenceContent , fix )
307+ const stats = await processLocale ( false , localeFile , referenceContent , fix )
302308 results . push ( {
303309 file : localeFile ,
304310 ...stats ,
0 commit comments