fix: handle single file i18n correctly (#936)

This commit is contained in:
Daniel Lautzenheiser
2023-10-12 12:03:26 -04:00
committed by GitHub
parent cc07c77b36
commit c37f44b5f5

View File

@ -10,6 +10,7 @@ import { dirname } from 'path';
import { resolveFormat } from './formats/formats';
import { commitMessageFormatter, slugFormatter } from './lib/formatters';
import {
I18N_STRUCTURE_MULTIPLE_FILES,
I18N_STRUCTURE_MULTIPLE_FOLDERS,
formatI18nBackup,
getFilePaths,
@ -300,7 +301,11 @@ function i18nRulestring(ruleString: string, { defaultLocale, structure }: I18nIn
return `${defaultLocale}\\/${ruleString}`;
}
return `${ruleString}\\.${defaultLocale}\\..*`;
if (structure === I18N_STRUCTURE_MULTIPLE_FILES) {
return `${ruleString}\\.${defaultLocale}\\..*`;
}
return ruleString;
}
function collectionRegex<EF extends BaseField>(collection: Collection<EF>): RegExp | undefined {