Skip to content

[browser][coreclr] ICU download#121800

Merged
dariatiurina merged 12 commits intodotnet:mainfrom
dariatiurina:icu-wasm-coreclr
Dec 4, 2025
Merged

[browser][coreclr] ICU download#121800
dariatiurina merged 12 commits intodotnet:mainfrom
dariatiurina:icu-wasm-coreclr

Conversation

@dariatiurina
Copy link
Contributor

@dariatiurina dariatiurina commented Nov 19, 2025

This PR implements the choosing, downloading the proper ICU shard into the memory and then activating it.

Changes:

  • Added new loadIcuData function in host.ts to allocate and initialize ICU.
  • Added selection of the appropriate ICU shard logic into the runtime bootstrap process asset fetching and loading into the runtime bootstrap process after that calling the newly implemented loadIcuData function.
  • Added coreclr_wasm_load_icu_data and related linkage functions to the ICU shim C file.
  • Commented out ENV["DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"] = "true"; in the libBrowserHost.footer.js and libCorerun.extpost.js allowing ICU-based globalization to be used when ICU data is loaded.

Resolves #120220

@radekdoulik radekdoulik added this to the Future milestone Nov 25, 2025
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Nov 26, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements ICU (International Components for Unicode) data loading functionality for browser/CoreCLR, enabling proper globalization support with culture-specific ICU shards. The implementation adds logic to detect the appropriate ICU shard based on the user's culture, download it, allocate memory, and initialize it before CoreCLR startup.

  • Adds ICU resource selection and sharding logic to automatically choose the appropriate ICU data file based on culture (EFIGS, CJK, or no-CJK shards)
  • Implements loadIcuData function for memory allocation and ICU initialization via WASM interop
  • Renames mono_wasm_load_icu_data to wasm_load_icu_data for runtime-agnostic naming across both Mono and CoreCLR

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/native/libs/System.Globalization.Native/pal_icushim_static.c Renamed mono_wasm_load_icu_data to wasm_load_icu_data and updated comment references
src/native/libs/Common/JavaScript/types/internal.ts Added wasm_load_icu_data method to EmscriptenModuleInternal interface
src/native/libs/Common/JavaScript/types/exchange.ts Added loadIcuData to BrowserHostExports type definitions
src/native/libs/Common/JavaScript/cross-module/index.ts Added loadIcuData to export table mapping
src/native/corehost/browserhost/loader/icu.ts New file implementing ICU resource name selection and culture-based sharding logic
src/native/corehost/browserhost/loader/bootstrap.ts Added ICU data fetching and loading to runtime bootstrap sequence
src/native/corehost/browserhost/libBrowserHost.footer.js Commented out DOTNET_SYSTEM_GLOBALIZATION_INVARIANT to enable ICU globalization
src/native/corehost/browserhost/host/index.ts Added loadIcuData export to BrowserHostExports table
src/native/corehost/browserhost/host/host.ts Implemented loadIcuData function with memory allocation and WASM interop
src/mono/browser/runtime/icu.ts Updated function name from mono_wasm_load_icu_data to wasm_load_icu_data
src/mono/browser/runtime/cwraps.ts Updated cwraps signature for renamed function
src/mono/browser/runtime/assets.ts Updated function call to use renamed wasm_load_icu_data
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems Added conditional compilation for CoreCLR-specific Interop.Locale file
src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs Added JavaScriptNative library constant
src/libraries/Common/src/Interop/Browser/Interop.Locale.CoreCLR.cs New CoreCLR-specific locale interop using LibraryImport
src/coreclr/vm/wasm/callhelpers-reverse.cpp Added CalendarData_EnumCalendarInfoCallback reverse thunk for globalization
src/coreclr/hosts/corerun/wasm/libCorerun.extpost.js Commented out invariant globalization setting

Copy link
Member

@pavelsavara pavelsavara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, thanks for doing it!

Copy link
Member

@ilonatommy ilonatommy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@dariatiurina dariatiurina merged commit ad43a8a into dotnet:main Dec 4, 2025
160 of 164 checks passed
@radekdoulik
Copy link
Member

Great work. The reverse helper function will be regenerated, that should still work fine though.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[browser][coreclr] ICU download - download proper shard and install it into memory

4 participants