In past few days I have been trying to make .resx localization works client side, because I love its generated class but unfortunately the generated class keeps falling back to the neutral language and not any other localized ones even with CultureInfo override specified.
I found that the main problem is that Blazor would include only main dll which contains your main localization resx. Other languages were separated by Visual Studio to a different satellite assembly and wouldn't be sent to client side, so it only works from server where all those dll are available.
What I did is to avoid naming the resx as AAA.resx, AAA.ja.resx but instead use AAA_ja.resx so Visual Studio don't see it as localized version and put them together in the main dll and ensure client get all languages on loading the SPA web app. Then I have to make a modified version of ResourceManager that knows how to look for _ separated resource according to incoming CultureInfo. It was very hacky but somehow I could get it to work. I have summarized the steps here if anyone interested in following : gametorrahod.com/workaround-for-cl...
The dependency of Visual Studio to edit .resx file still exists, but my website wouldn't be that large for now so I could put up with the difficulties :P Still I like that .resx could pack images into a binary which reads as byte[] from the generated static class, so I could make localized images bytes instead of localized image paths.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In past few days I have been trying to make
.resxlocalization works client side, because I love its generated class but unfortunately the generated class keeps falling back to the neutral language and not any other localized ones even withCultureInfooverride specified.I found that the main problem is that Blazor would include only main
dllwhich contains your main localizationresx. Other languages were separated by Visual Studio to a different satellite assembly and wouldn't be sent to client side, so it only works from server where all thosedllare available.What I did is to avoid naming the
resxasAAA.resx,AAA.ja.resxbut instead useAAA_ja.resxso Visual Studio don't see it as localized version and put them together in the maindlland ensure client get all languages on loading the SPA web app. Then I have to make a modified version ofResourceManagerthat knows how to look for_separated resource according to incomingCultureInfo. It was very hacky but somehow I could get it to work. I have summarized the steps here if anyone interested in following : gametorrahod.com/workaround-for-cl...The dependency of Visual Studio to edit
.resxfile still exists, but my website wouldn't be that large for now so I could put up with the difficulties :P Still I like that.resxcould pack images into a binary which reads asbyte[]from the generated static class, so I could make localized images bytes instead of localized image paths.