File tree Expand file tree Collapse file tree
core/ecschema-metadata/src/Localization Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ export class LocalizationProvider implements ILocalizationProvider {
4848 // Try fallback to language without region (e.g., "es-CO" → "es")
4949 if ( ! localizationData && locale . includes ( "-" ) ) {
5050 const baseLocale = locale . split ( "-" ) [ 0 ] ;
51+ const baseCacheKey = `${ schemaName } :${ baseLocale } ` ;
52+
53+ if ( this . _localizationCache . has ( baseCacheKey ) ) {
54+ return this . _localizationCache . get ( baseCacheKey ) ;
55+ }
56+
5157 localizationData = await this . _loader ( schemaName , baseLocale ) ;
5258 }
5359
@@ -65,7 +71,9 @@ export class LocalizationProvider implements ILocalizationProvider {
6571 throw new Error ( `Localization JSON mismatch for ${ schemaName } :${ locale } - expected locale "${ expectedLocale } " but got "${ localizationData . locale } "` ) ;
6672 }
6773
74+ const cacheKey = `${ schemaName } :${ localizationData . locale } ` ;
6875 this . _localizationCache . set ( cacheKey , localizationData ) ;
76+
6977 return localizationData ;
7078 }
7179
You can’t perform that action at this time.
0 commit comments