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.