✅ .NET Localization Culture Fallback
Hi, I'm using .NET localization in a blazor wasm hosted app, and I have the following issue:
Let's consider the generic class myclass, for which I have the following files:
myclass.razor
myclass.razor.cs
myclass.en.resx (english translations)
myclass.it.resx (italian translations)
Now, if I access the web app by means of a browser with culture set to "en", the english translations are displayed correctly. In fact, from developer tools I can see the request
http://.../_framework/en/Client.resources.dll, which is answered with a 200 OK containing some data as response.
If then I set the browser culture to "en-US", no term is translated. In fact I see browser is making the following requests:
http://.../_framework/en-US/Client.resources.dll
http://.../_framework/en/Client.resources.dll
Both of which are answerede with a 304 Not Modified.
I've tested on Firefox and Edge: the behavior is the same.
This is strange because the documentation describes a "Culture fallback" mechanism that should make the above scenario work.
Any idea what I could be doing wrong?
Thanks
Let's consider the generic class myclass, for which I have the following files:
myclass.razor
myclass.razor.cs
myclass.en.resx (english translations)
myclass.it.resx (italian translations)
Now, if I access the web app by means of a browser with culture set to "en", the english translations are displayed correctly. In fact, from developer tools I can see the request
http://.../_framework/en/Client.resources.dll, which is answered with a 200 OK containing some data as response.
If then I set the browser culture to "en-US", no term is translated. In fact I see browser is making the following requests:
http://.../_framework/en-US/Client.resources.dll
http://.../_framework/en/Client.resources.dll
Both of which are answerede with a 304 Not Modified.
I've tested on Firefox and Edge: the behavior is the same.
This is strange because the documentation describes a "Culture fallback" mechanism that should make the above scenario work.
Any idea what I could be doing wrong?
Thanks
Learn the concepts of localization while learning how to use the IStringLocalizer and IStringLocalizerFactory implementations in your .NET workloads.
