Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

fix: handle single file i18n correctly #936

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/core/src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down