I need to embed a Blazor server-side component to an existing asp.net core project.
I followed the tutorial of this https://medium.com/@geobourno/bringing-blazor-in-an-existing-net-core-mvc-project-d605d9f9ebe8 by creating a brand new blazer server-side project in the same solution.
All works well.
Now I added the Localizer to the blazor server-side project and want to set the language of its Localizer the same as the asp.net core project(the asp.net core project is choosing the language by URL just ashttps://www.microsoft.com/en-us/).
Meanwhile, the blazor only set its language the same as the browser while running.
I think I should set a parameter(which to record the language type) of blazor component in asp.net core first. After blazor runs, it gets the parameter and set the language the same as it.
I don't know whether my idea is right but I just want to set the language of its Localizer the same as the asp.net core project dynamically.
PS:
Someone tells me to achieve it like this in OnAfterRenderAsync of blazor:
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("zh-hant");
CultureInfo.CurrentCulture = new CultureInfo("zh-hant");
CultureInfo.CurrentUICulture = new CultureInfo("zh-hant");
Well, it doesn't work any.
How can I solve this? Thank you.