getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

When logging into the Panel in a multi-language installation, the preselected content language is not the default language. #3647

Closed texnixe closed 3 years ago

texnixe commented 3 years ago

Describe the bug
In Kirby 3.5.7.1 (and probably earlier versions), when you have a multi-language setup with German as default and English as secondary language, and you log in to the Panel, the content language switcher defaults to the default language (in this case this would be German).

From my tests it seems as if Kirby remembers which language version I was working on last, because when I log out while in the German default translation and then log back in, I am back in the German version. However, when cookies and sessions are deleted, I return to the English version. This happens independent of the selected user language.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a multi-language Starterkit with German as default and English as secondary language
  2. Log into the Panel
  3. Watch the language switcher default to the secondary language.

Expected behavior
I would expect the same behavior as in 3.5.7.1.

Kirby Version
Tested with 3.6.0-alpha-4

Desktop (please complete the following information):
Mac OS11.2.2 with Firefox 91.0 (64-bit)

Additional context
https://forum.getkirby.com/t/default-language-not-used-after-login/23207/5

distantnative commented 3 years ago

So solution could be to clear the session value when logging in successfully? That way it should reset the behavior to the default language.

lukasbestle commented 3 years ago

That makes sense! Basically $session->remove('panel.language');.

distantnative commented 3 years ago

OK I think I misread @texnixe's description. When testing the bug myself, it occurred to me that not the session is the problem (which could be fixed by its removal), but rather that even if I delete all sessions, cookies... myself before logging in, the content language switcher defaults to English instead of the default language German.

My current guess is, that somewhere instead of the default content language, the default Panel UI language is chosen or something like that.

distantnative commented 3 years ago

Seems to be a backende problem. This line https://github.com/getkirby/kirby/blob/develop/src/Panel/View.php#L152 already returns the English language object.

MaluNoPeleke commented 3 years ago

I just deleted every cache/session file and logged in again and the content language was still in English while panel language was set to German. This should be the same by default and only different if the user changes it.

distantnative commented 3 years ago

@MaluNoPeleke That's what I just wrote 😄

bastianallgeier commented 3 years ago