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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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