-
Notifications
You must be signed in to change notification settings - Fork 4
Is there a way start app in another culture rather than the default? #29
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
Comments
I did not think about the use case where you would want a controller in english but a different default culture when I wrote this. In the
And the To support what you'd want I think instead of using the |
The only option I came up without changing any core functionality (as I am not familiar with the routing in net core) is at the begginnig set the DefaultCulture to But, no matter what, this codebase should support this usecase as well, any supported culture could be default (think of accept headers). |
I agree that it should be supported. It should be a common use case since coding in english is common. Most likely the routing because of default ASP.NET will keep the controller name and actions, I don't remember if you can remove that. So I think most likely for you for HomeController the routing would end up being: And then it's the job of the |
Actually what I need is;
I tried below, but the default culture's routes are being omitted in somewhere, I guess, didn't work. Also I tried to use
As it takes long time to grasp the code to check/test if this is doable, I need your opinion. What do you think? |
If I remember correctly myself they are omitted. I can't remember there being an option to force the default culture. If you want to force /en/ and /tr/ you could try and create a third culture and redirect to /tr/ if that third culture is found by using a middleware for requests as a workaround. I tested some and if you define a Which means that it's probably easier to fix the initial issue, That you can write the controller name in english but use a different default culture. |
I want to do this but, shouldn't |
You just use a middleware I believe. It could also be possible inside the |
Hi,
First of all, thanks for your efforts on this.
I am trying to implement your work on my project. I have two supported languages, English and Turkish. The default culture should be Turkish (tr), however I would like to keep controller and action names in English in the source code. These names would generate the urls in English as well. So in Startup.cs I changed default culture to >
tr
LocalizationRouteDataHandler.DefaultCulture = "tr";
However, it does not generate localized urls, instead generates in english. But if I set ti to
en
, and then change the culture totr
, then it generate the localized urls.What I mean is if I give an example on your sample project, I want this project to start with
LocalizationRouteDataHandler.DefaultCulture = "fi";
and all actions shold be localized on startup.
Could you help me on this?
The text was updated successfully, but these errors were encountered: