Skip to content

Commit a5df0eb

Browse files
further fixes
1 parent d3a75b3 commit a5df0eb

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

core/ecschema-metadata/src/Localization/LocalizationProvider.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)