@@ -228,6 +228,11 @@ export class I18nPlugin extends RuntimePlugin<LocalizationPluginOptions> {
228
228
for ( const file of files ) {
229
229
if ( file . isFile ( ) ) {
230
230
const ext = extname ( file . name ) ;
231
+ const parentFolder = file . parentPath . split ( '/' ) . pop ( ) ;
232
+ const namespace =
233
+ parentFolder ?. startsWith ( '(' ) && parentFolder ?. endsWith ( ')' )
234
+ ? parentFolder ?. slice ( 1 , - 1 )
235
+ : null ;
231
236
232
237
if ( ! / \. j s o n $ / . test ( ext ) ) continue ;
233
238
@@ -239,7 +244,9 @@ export class I18nPlugin extends RuntimePlugin<LocalizationPluginOptions> {
239
244
} else {
240
245
name = basename ( file . name , ext ) ;
241
246
}
242
- namespaces . add ( `${ isEvent ? 'event_' : '' } ${ name } ` ) ;
247
+ namespaces . add (
248
+ `${ isEvent ? 'event_' : '' } ${ namespace ? `${ namespace } _` : '' } ${ name } ` ,
249
+ ) ;
243
250
244
251
const locale = basename ( file . parentPath ) ;
245
252
@@ -253,6 +260,11 @@ export class I18nPlugin extends RuntimePlugin<LocalizationPluginOptions> {
253
260
}
254
261
} else if ( file . isFile ( ) ) {
255
262
const ext = extname ( file . name ) ;
263
+ const parentFolder = file . parentPath . split ( '/' ) . pop ( ) ;
264
+ const namespace =
265
+ parentFolder ?. startsWith ( '(' ) && parentFolder ?. endsWith ( ')' )
266
+ ? parentFolder ?. slice ( 1 , - 1 )
267
+ : null ;
256
268
257
269
if ( ! / \. j s o n $ / . test ( ext ) ) continue ;
258
270
@@ -264,7 +276,9 @@ export class I18nPlugin extends RuntimePlugin<LocalizationPluginOptions> {
264
276
} else {
265
277
name = basename ( file . name , ext ) ;
266
278
}
267
- namespaces . add ( `${ isEvent ? 'event_' : '' } ${ name } ` ) ;
279
+ namespaces . add (
280
+ `${ isEvent ? 'event_' : '' } ${ namespace ? `${ namespace } _` : '' } ${ name } ` ,
281
+ ) ;
268
282
269
283
const locale = basename ( file . parentPath ) ;
270
284
0 commit comments