feat(core): Global lazy Intl polyfills and locale-sensitive date formatting#1608
Merged
Conversation
MrTango
requested changes
Jun 24, 2026
Contributor
|
@erral when you have time, please have another look at this ;) |
Co-authored-by: Maik Derstappen <md@derico.de>
Member
Author
|
@MrTango I have tested it and it works with your changes too. |
MrTango
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves date formatting across Plone patterns and introduces a global mechanism for lazily loading polyfills and locale data.
Key Changes
formatDateinpat-filemanagerto respect the Plone site language from<html lang='...'>(normalized forIntl).src/core/intl-loader.jswhich detects if the browser natively supports the current locale. If not, it lazily fetches the@formatjs/intl-datetimeformatpolyfill and specific locale data chunks. This ensures languages like Basque (eu) are correctly supported even in limited environments.pat-filemanager,pat-contentbrowser, andpat-structure.src/core/intl-loader.test.jsverifying that missing locales trigger polyfill loading and result in correct language-specific output.Why?
Previously, date formatting often defaulted to the browser's language, leading to UI inconsistencies in Plone sites with a different language than the user's OS. Furthermore, many browsers lack data for certain languages (like
eu), causing formatting to fallback to English or fail. This PR provides a robust, per-language lazy-loading solution that fixes these issues for all patterns with minimal overhead.