-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Merged PR 9371: Revive support for globalization and localization in Blazor WASM #24773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -239,14 +239,26 @@ function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourceLoade | |||
/* hash */ resourceLoader.bootConfig.resources.runtime[dotnetWasmResourceName], | |||
/* type */ 'dotnetwasm'); | |||
|
|||
const dotnetTimeZoneResourceName = 'dotnet.timezones.dat'; | |||
const dotnetTimeZoneResourceName = 'dotnet.timezones.blat'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo or a legit file format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've heard Larry talk about this so I guess it's the name of the archive file format. Apparently it's like a tar
file.
let timeZone = "UTC"; | ||
try { | ||
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
} catch { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it OK to ignore errors thrown here?
@@ -192,10 +193,10 @@ public async Task Build_WithBlazorEnableTimeZoneSupportDisabled_DoesNotCopyTimeZ | |||
|
|||
var runtime = bootJsonData.resources.runtime.Keys; | |||
Assert.Contains("dotnet.wasm", runtime); | |||
Assert.DoesNotContain("dotnet.timezones.dat", runtime); | |||
Assert.DoesNotContain("dotnet.timezones.blat", runtime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah -- OK. So the blat
file extension is intentional...
@@ -55,7 +57,8 @@ public virtual async ValueTask LoadCurrentCultureResourcesAsync() | |||
|
|||
for (var i = 0; i < assemblies.Length; i++) | |||
{ | |||
Assembly.Load((byte[])assemblies[i]); | |||
using var stream = new MemoryStream((byte[])assemblies[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is mostly porting pre-existing changes so approving. Looks good anyway.
c3df503
to
3818ef0
Compare
@lewing I'm seeing issues with non-en cultures. Here's the stack trace:
Could you help? |
I'll take a look; getting this set up locally. |
Finally got a repro working, looking into this now. |
Building locally with the linker disabled and swapping out SPC for one built with dotnet/runtime#40817 seems to fix this locally, so hopefully once that change flows down to this repo we'll be good to go. 😄 |
3818ef0
to
4e57d1b
Compare
Hello @pranavkm! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
@benaadams we're looking at sharding the icu file, which should make the default compressed size about half of the numbers being reported here. There's also an option to enable invariant mode if you do not require this data that should eliminate this file entirely. |
Manually porting preview8 changes to master
Revive support for globalization and localization in Blazor WASM
Fixes #24174
Fixes #22975
Fixes #23260