@@ -46,6 +46,7 @@ import {
46
46
getI18nDataFiles ,
47
47
getI18nBackup ,
48
48
formatI18nBackup ,
49
+ getI18nInfo ,
49
50
} from './lib/i18n' ;
50
51
51
52
import type AssetProxy from './valueObjects/AssetProxy' ;
@@ -307,6 +308,27 @@ function collectionDepth(collection: Collection) {
307
308
return depth ;
308
309
}
309
310
311
+ function collectionRegex ( collection : Collection ) : RegExp | undefined {
312
+ console . log ( 'collection' , collection . toJS ( ) ) ;
313
+ let ruleString = '' ;
314
+
315
+ if ( collection . get ( 'path' ) ) {
316
+ ruleString = `${ collection . get ( 'folder' ) } /${ collection . get ( 'path' ) } ` . replace (
317
+ / { { .* } } / gm,
318
+ '(.*)' ,
319
+ ) ;
320
+ }
321
+
322
+ if ( hasI18n ( collection ) ) {
323
+ const { defaultLocale } = getI18nInfo ( collection ) as { defaultLocale : string } ;
324
+ ruleString += `\\.${ defaultLocale } \\..*` ;
325
+ }
326
+
327
+ console . log ( 'ruleString' , ruleString ) ;
328
+
329
+ return ruleString ? new RegExp ( ruleString ) : undefined ;
330
+ }
331
+
310
332
export class Backend {
311
333
implementation : Implementation ;
312
334
backendName : string ;
@@ -552,7 +574,12 @@ export class Backend {
552
574
const depth = collectionDepth ( collection ) ;
553
575
const extension = selectFolderEntryExtension ( collection ) ;
554
576
return this . implementation
555
- . allEntriesByFolder ( collection . get ( 'folder' ) as string , extension , depth )
577
+ . allEntriesByFolder (
578
+ collection . get ( 'folder' ) as string ,
579
+ extension ,
580
+ depth ,
581
+ collectionRegex ( collection ) ,
582
+ )
556
583
. then ( entries => this . processEntries ( entries , collection ) ) ;
557
584
}
558
585
0 commit comments