Skip to content

IBX-11127: Datepicker is always in english despite BO language change#1806

Merged
mikadamczyk merged 2 commits into4.6from
IBX-11127-flatpickr-translation-fix
Apr 8, 2026
Merged

IBX-11127: Datepicker is always in english despite BO language change#1806
mikadamczyk merged 2 commits into4.6from
IBX-11127-flatpickr-translation-fix

Conversation

@Sztig
Copy link
Copy Markdown
Contributor

@Sztig Sztig commented Dec 23, 2025

🎫 Issue IBX-11127

Description:

Flatpickr translation script was being included too late in the chain so I have moved it before the layout-js.

@Sztig Sztig requested a review from a team December 23, 2025 14:02
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 Bot requested review from GrabowskiM, OstafinL, albozek, alekmick, dew326 and tischsoic and removed request for a team December 23, 2025 14:02
@sonarqubecloud
Copy link
Copy Markdown

@mateuszdebinski mateuszdebinski added Bug Something isn't working Ready for review labels Dec 29, 2025
@GrabowskiM
Copy link
Copy Markdown
Contributor

I'm not sure if it's correct solution for this problem. For one it can be some BC change, as if someone made custom layout and includes there admin-ui-layout he will not have this flatpickr file there. But what mainly concerns me, is that with this solution it's kind of race condition.

If I understand correctly, the problem is that we initialize flatpickr instances in code before calling localize method so existing ones have old language, as they can't change their language live. And by putting it to totally new (and much lighter) entry browsers load it much faster than admin-ui-layout therefore executes it before any initialization happens.
If that's the case, maybe we could just put this file at the begininng of admin-ui-layout, therefore it would be executed before anything else?

In theory we use flatpickr only internally, inside our DateTimePicker class so this could be set there as well, but that's risky, as if someone uses it out-of-the-box he would have to call localize by himself...

@GrabowskiM
Copy link
Copy Markdown
Contributor

I'm not sure if it's correct solution for this problem. For one it can be some BC change, as if someone made custom layout and includes there admin-ui-layout he will not have this flatpickr file there. But what mainly concerns me, is that with this solution it's kind of race condition.

If I understand correctly, the problem is that we initialize flatpickr instances in code before calling localize method so existing ones have old language, as they can't change their language live. And by putting it to totally new (and much lighter) entry browsers load it much faster than admin-ui-layout therefore executes it before any initialization happens. If that's the case, maybe we could just put this file at the begininng of admin-ui-layout, therefore it would be executed before anything else?

In theory we use flatpickr only internally, inside our DateTimePicker class so this could be set there as well, but that's risky, as if someone uses it out-of-the-box he would have to call localize by himself...

Discussed in private - changing order in admin-ui-layout didn't work, therefore I'll approve current solution. It's not perfect (as we rely on size of that file) but it's much smaller change than changing structure of DatePicker, enforcing custom calls to localize with each call to flatpickr etc.

@KamilSznajdrowicz KamilSznajdrowicz force-pushed the IBX-11127-flatpickr-translation-fix branch from 2afa369 to ee72421 Compare March 25, 2026 08:29
Copy link
Copy Markdown
Contributor

@KamilSznajdrowicz KamilSznajdrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Approved
PR tested on 4.6.x-dev, patch applied and successfully tested on v4.6.28

PHPSTAN fix in: #1856

@Sztig Sztig force-pushed the IBX-11127-flatpickr-translation-fix branch from ee72421 to f1bd12b Compare April 8, 2026 12:13
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@mikadamczyk mikadamczyk merged commit 04eae0b into 4.6 Apr 8, 2026
28 checks passed
@mikadamczyk mikadamczyk deleted the IBX-11127-flatpickr-translation-fix branch April 8, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working QA approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants