New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Culture in URL required? #15
Comments
Hi Morgan, The culture fallback behaviour works for the main route that ends with But for all other routes like So if you want to use route value based localization the best solution is to guarantee the presence of Notice:If the application is using razor pages and controllers the route convention for both must be configured in startup: .AddMvcOptions((ops) => {
...
ops.Conventions.Insert(0, new RouteTemplateModelConventionMvc());
})
.AddRazorPagesOptions((ops) => {
ops.Conventions.Insert(0, new RouteTemplateModelConventionRazorPages());
})
.... Best regards, |
Hi Ziya, Sorry for the delay getting back to you. Ok that makes sense, thank you. So my understanding is that XLocalizer will only fallback to my default culture if I think in previous projects I had a route of something like Thankfully, I found a nice AnchorTagHelper that, when modified slightly, automatically adds the current culture to the URL. The thought of adding Kind regards, |
I know that taghelper, and I've used a similar approach for a while, but for now I prefer to manually add the Kind regards, |
Meanwhile, if you don't use The downside of this appoarch that it depends on cookies, so if the user has not allowed cookies it will not work properly, additionally you can't share localized URLs. |
Yes, I stumbled across that issue, too. I like the tag helper approach as it should allow me to just remove the tag helper if/when the official solution is released. I think, by far, the Cheers |
Hi Ziya
I'm having a little bit of an issue with culture routing in my application. I've not had this problem before, so I'm wondering if something has changed in XLocalizer, or whether I'm doing something silly again.
Here's my
Startup.cs
after following Using DB as Localization Source:If I make a request to
/
, I recieve the Index page in English--perfect.If they make a request to
/Dashboard
(for example), the routing seems to break. Instead of seeing the Dashboard page, I still see Index page. However, if I put/en/Dashboard
in the URL manually, the Dashboard page displays as expected.My understanding was if there is no culture in the URL, the fallback one will be used instead. I read Culture fallback behaviour and that sounds ideal, I just can't seem to get it to work.
Any idea what's going on? Maybe I need to update something in the
app.UseEnpoints()
?Thank you
Morgan
The text was updated successfully, but these errors were encountered: