I would like to get view localization based on the url instead of browser culture.
"/account/leadregistrationstep/de" Will display the view without translation. To get the translation the browser culture must match with the view (this works).
Is there a way to get the translation without having the browser culture need to match the resource file? I want the german view to display only german language
Startup ConfigureServices
services.Configure<RequestLocalizationOptions>(
options =>
{
var supportedCultures = new List<CultureInfo>
{
new CultureInfo("en"),
new CultureInfo("de"),
new CultureInfo("nl"),
new CultureInfo("fr")
};
options.DefaultRequestCulture = new RequestCulture(culture: "nl", uiCulture: "nl");
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
options.RequestCultureProviders.Insert(0, new QueryStringRequestCultureProvider());
});
Configure
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{language}/{id?}");
});
