Blazor Localization - how do I set the locale for a session/circuit?

75 Views Asked by At

Setting the locale in Blazor server.

I want to save off the locale the user selects as part of the user object. This way, as they continue using the website, including returning to the site, it is set to the locale they set.

I've got localization working as illustrated in this post (works perfectly). But it is built around the user selecting the locale each time. How can I set it for the session/circuit?

In other words, I load the user object and User.Locale has the value "en-US". How do I now have the localization give me the en strings?

And related question, how do I use that locale so that DateTimes and numbers are formatted according to the selected region?

0

There are 0 best solutions below