Skip to content

Commit 453ceec

Browse files
authored
Enable custom ICU loading + correct EFIGS keys. (#47419)
1 parent 6f96064 commit 453ceec

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

src/Components/Web.JS/src/Platform/BootConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,6 @@ export type ExtendedResourceList = {
8383
export enum ICUDataMode {
8484
Sharded,
8585
All,
86-
Invariant
86+
Invariant,
87+
Custom
8788
}

src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -493,29 +493,43 @@ function attachInteropInvoker(): void {
493493
}
494494

495495
function getICUResourceName(bootConfig: BootJsonData, culture: string | undefined): string {
496+
if (bootConfig.icuDataMode === ICUDataMode.Custom) {
497+
const icuFiles = Object
498+
.keys(bootConfig.resources.runtime)
499+
.filter(n => n.startsWith('icudt') && n.endsWith('.dat'));
500+
if (icuFiles.length === 1) {
501+
const customIcuFile = icuFiles[0];
502+
return customIcuFile;
503+
}
504+
}
505+
496506
const combinedICUResourceName = 'icudt.dat';
497507
if (!culture || bootConfig.icuDataMode === ICUDataMode.All) {
498508
return combinedICUResourceName;
499509
}
500510

501511
const prefix = culture.split('-')[0];
502-
if ([
503-
'en',
504-
'fr',
505-
'it',
506-
'de',
507-
'es',
508-
].includes(prefix)) {
512+
if (prefix === 'en' ||
513+
[
514+
'fr',
515+
'fr-FR',
516+
'it',
517+
'it-IT',
518+
'de',
519+
'de-DE',
520+
'es',
521+
'es-ES',
522+
].includes(culture)) {
509523
return 'icudt_EFIGS.dat';
510-
} else if ([
524+
}
525+
if ([
511526
'zh',
512527
'ko',
513528
'ja',
514529
].includes(prefix)) {
515530
return 'icudt_CJK.dat';
516-
} else {
517-
return 'icudt_no_CJK.dat';
518531
}
532+
return 'icudt_no_CJK.dat';
519533
}
520534

521535
function changeExtension(filename: string, newExtensionWithLeadingDot: string) {

0 commit comments

Comments
 (0)