Add localization to the BlazorStatic website
Feature Request: Route-Based Localization for the Documentation Site
Add route-based localization support to the BlazorStatic documentation website — something like /en, /fr, etc., to showcase the capabilities of the library.
This would be implemented following the official Microsoft approach:
🔗 Localization in ASP.NET Core
To handle culture detection from the URL, the BlazorServerUrlRequestCultureProvider NuGet package would be used. It extracts the culture from the route and sets it for the current request, allowing us to ditch the cookie based approach Microsoft uses.
I wonder how these will be solve:
- page
/en/somepageand its french equivalent/fr/somepage- or
/en/somepageand/en/unepage?
- or
blog/en/post1and its french equivalent which source is in different md.- can we do
@page "/{lang}/{post}"or this is not how it's done? - I guess we need some localization nav menu and similar - this should probably go with .resx files, right?
- we need to cleverly iterate over all the pages, but on the other hand we don't wanna complicate things much. Maybe BlazorStatic should provide some simplification to that (list of languages and some convention where the language is put).
-
we can either do
/en/home,/fr/accueilor/en/home,/fr/home. -
we can have translated copies of each post with the name
post.lang.md, when a page is loaded we check if the requested language is available in the post else we use the default one. -
maybe? but then it will be possible for the user to type any random text in the first parameter, the approach i use is multiple
@pagedirectives (that's why i did the previous PR) -
yeah we'll use
.resxfiles so we can make use of the Microsoft Localization extension. -
this feature will not be included in BlazorStatic the library (sorry if i made it sound like that), just the documentation website, adding it to the library doesn't make sense when it's super easy to implement.