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?
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:
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:
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.