Really strange behavior that makes Kirby save to wrong content file

As far as I understand it, the added field sets the panel language here: https://github.com/getkirby/panel/blob/master/app/src/panel.php#L272

Using a different name, by prefixing it, renders this useless. Doesnā€™t it?

Yes, you are right, I overlooked that. But isnā€™t this supposed to get the language from the language select field not from this hidden field?

Exactly! Thatā€™s why it works.

Normally the language query parameter is set by the language switcher in the upper right corner of the panel. But when you submit a form, that field is not included. The panel sends the data just hoping that the info in the session is correct. Therefore I suggested (see post #8) to include a hidden field with name language, mimicking the switcher, so that the panel language is reset to whatever language the POST ā€œcame fromā€.

IMHO the hidden field should stay there being posted together with the data, because conceptually it belongs there. The safest and easiest way to ensure consistency between data and metadata is to send it together. The session should really not be used to try and mirror the client application state. Just think about tabs: what happens if I try to have 2 tabs in different languages? Itā€™s impossible to model this correctly in a session.
In fact this issue can be demoed simply with tabs:

  1. download the langkit and put it on a server
  2. access the panel
  3. go to a page in the panel
  4. duplicate the tab, letā€™s call them Tab A and B
  5. open Tab B and change the panel language with the switcher (this sets the session info to a new language)
  6. go back to tab A and just hit save (without refreshing first)

You just deleted the contents in the language of tab B.

And this use-case isnā€™t even far fetched, just think about someone translating a page: itā€™s not that uncommon to want the original content in another window aside. This is currently impossible, unless you remember ā€œthe correct order of refreshesā€.

IMHO 2 the User panel view should be corrected to not use ā€œlanguageā€ as a key, exactly like the other blueprints where you canā€™t use ā€œlanguageā€ as a field name (because it is reserved for the panel).
In fact, this currently causes a minor ā€œmisbehaviorā€ of the panel:

  1. in the langkit installation of before, set the language to english (just close the other tab)
  2. go to the user admin view
  3. create a random new user and set his language to ā€œdeutschā€
  4. save
  5. return to the dashboard and notice that your panel now is also set to Deutsch

Of course one could leave the user view like it is and rename the language switcher instead, to something more unique, like: ā€œkirbypanel_languageā€ or somethingā€¦

Ok, I deleted my post as it does not make sense without further changes.

This definitely needs are more robust overall solution.

Anyway, I hope we will have a solution soon, the milestone is currently set to 2.5.8. The next RC is already out, so there will be no fix in Kirby 2.5.7 yet.