File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -217,23 +217,13 @@ const processLocale = async (
217217 const localeInfo = checkJsonName ( filePath )
218218
219219 if ( fix ) {
220- // prevent update
221- // country locale file: e.g. es or es-ES
222- if ( localeInfo . forCountry ) {
223- // prevent adding missing keys to target locale: e.g. es-ES
224- // in this case i18n will do the work for us, the target locale should be empty
225- if ( localeInfo . mergeLocale ) {
226- console . error (
227- `${ COLORS . red } Error: Locale "${ localeInfo . locale } " cannot be fixed, fix the ${ localeInfo . lang } locale instead!${ COLORS . reset } ` ,
228- )
229- process . exit ( 1 )
230- }
231- }
232- // prevent fix country locale, i18n will merge lang file and the target locale:
233- // e.g. es-419: i18n will merge es and es-419 for us
234- else if ( localeInfo . mergeLocale ) {
220+ // prevent updating wrong locale file:
221+ // - language locale files at countries allowed: e.g. es.json
222+ // - country locale file forbidden: e.g. es-ES.json
223+ // - target locale file forbidden: e.g. es-419.json
224+ if ( localeInfo . mergeLocale ) {
235225 console . error (
236- `${ COLORS . red } Error: Locale "${ localeInfo . locale } " cannot be fixed.! ${ COLORS . reset } ` ,
226+ `${ COLORS . red } Error: Locale "${ localeInfo . locale } " cannot be fixed, fix the ${ localeInfo . lang } locale instead!. ${ COLORS . reset } ` ,
237227 )
238228 process . exit ( 1 )
239229 }
You can’t perform that action at this time.
0 commit comments