OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.34k stars 2.37k forks source link

Default culture does not apply (in Localization settings) #4030

Open ampadashi opened 5 years ago

ampadashi commented 5 years ago

The default culture of my application is en-US. When I add fa-IR culture and set it as default, the language of the admin panel will not be changed. The only way to change the language is to remove en-US culture from website which is not a good idea. Even when I add ?culture=fa-ir to the address, it will changed the language of the current page only.

Skrypt commented 5 years ago

This is not an issue it's working as expected. What you need is a culture picker in the admin which is probably missing an implementation. The proper solution for you is to keep both culture set in OC and to change the priority of cultures in your browser settings by setting fa-IR as the default culture of your browser and to keep en-US as a second choice for now.

sebastienros commented 5 years ago

To explain what @Skrypt said differently, even if you set IR as the default language instead of EN, the admin will take what your browser requests first, and we suppose that you have set en before ir in your browser. This is the accept-language header that your browser sends. To be able to force an admin language we need to implement a custom culture picker for the admin, which would have a higher priority than the header your browser is sending. You can implement it if you want, and we'll gladly accept a PR.

ampadashi commented 5 years ago

I usually use google chrome and in its settings, when we move up the Persian language to the top, the language of the browser will change to persian too which it’s not desired. Mostly, Iranian users prefer to set English as the default language of their browsers. So, We must be able to use fa-IR culture without changing the language of the browser. Please let me know your comments.

sebastienros commented 5 years ago

As suggested then you need a culture picker feature in the admin such that each user will be able to chose the version of the admin.

Another solution, which would not be incompatible, is to add a new setting to select which culture should be used for the admin, with a higher priority than the accept-language header. But a lower one than an eventual culture picker.

ampadashi commented 5 years ago

I think it’s a good idea. With this solution, even if we set more that two cultures, we can switch easily.

hishamco commented 5 years ago

@sebastienros what if we tweak the localization middleware little bit by enforcing that localization settings default culture get served first if the localization module is enabled otherwise localization middleware will work as usual.

FYI no need to introduce culture picker in my case

If sound is good I can send a PR for it

sebastienros commented 5 years ago

What you are suggesting is the same as me if:

hishamco commented 5 years ago

It could be checkbox, I was thinking to add it as LocalizationOption in the code, and it's on by default unless you don't like the behavior you can override it

While it's scheduled for 1.0.x, I will send a PR at that time

sebastienros commented 5 years ago

This would mean to change it by code and I think it should be simpler for users. Also the current default is totally fine. The new behavior should be triggered by a gesture.

ampadashi commented 5 years ago

Hisham, in a cms, i think it’s so important to be able to apply default culture without changing browser settings. It’s an important issue and it’s better to solve it the version 1, as soon as possible.

hishamco commented 5 years ago

This would mean to change it by code and I think it should be simpler for users.

Yes it's, by changing this property via the admin, like what we did in localization settings

Hisham, in a cms, i think it’s so important to be able to apply default culture without changing browser settings.

Seems you didn't see my comment and it's on by default

It’s an important issue and it’s better to solve it the version 1, as soon as possible.

I am not authorized to schedule the tasks

hishamco commented 5 years ago

@ampadashi you can implement this by yourself if you are on harry, believe it or not there 're a lot of things we should do before 1.0.0 release, the important thing is stability and bug free as much as we can

ampadashi commented 5 years ago

@hishamco ok, i try. thanks;)

aaronamm commented 3 years ago

@ampadashi Here is how I get it work. https://www.dotnetthailand.com/web-frameworks/orchard-core-cms/localization-in-orchard-core-cms#settingadefaultculturedoesnottakeaneffect.