Localization not working in Browser using .NET 8 #15223
-
Describe the bugLocalization following the guide Localizing using ResX does not work in the browser when targeting .NET 8. To ReproduceReference the Localizing using ResX guide to create a localization project.
Expected behaviorFor both desktop and browser variants, the app should display the word "japanese" in the middle of the screen. This works for Desktop. This does not work for Browser. In the browser, it shows the default value "english". Avalonia version11.0.10 OSWindows 10 v19045.3693, x64 Additional contextLocalization works for .NET 7 on the browser. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Avalonia doesn't manage System.Globalization on any platform. You might need to check documentation on that from Microsoft. |
Beta Was this translation helpful? Give feedback.
By default, the .NET WASM runtime doesn't load any satellite (resource) assemblies.
Blazor loads them for the current culture at startup (and doesn't support dynamic culture by default).
I don't believe it's Avalonia role to load them. You'll get the same behavior with a non-Blazor WASM project.
Workaround:
Before using the culture:
Only tested in .NET 8.0 (it might be different in .NET 7.0).
Source reference:
https://github…