Blazor Culture in the Route

Kuler Master 246 Reputation points
2024-04-26T18:27:26.8766667+00:00
  1. Is it recommended to add the language (culture) in the route e.g. site.com/en/page-name or only page name is sufficient e.g. site.com/page-name?
  2. How to I change the culture to de-DE if you paste the URL like the following?

mysite.com/de/home

Thank you

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,194 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,398 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
300 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,846 Reputation points
    2024-04-26T22:24:19.1966667+00:00

    that's your call.

    normally culture is stored in a cookie, so a link without culture specified in url would display in the users preferred language. the question is what should happen if the link is sent to another user. do you want the new user to see the page in their language or the language of the user sending the link?

    localization in Blazor:

    https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-8.0