Skip to content

feat(core): Global lazy Intl polyfills and locale-sensitive date formatting#1608

Merged
MrTango merged 10 commits into
masterfrom
fix-global-intl-polyfills
Jul 2, 2026
Merged

feat(core): Global lazy Intl polyfills and locale-sensitive date formatting#1608
MrTango merged 10 commits into
masterfrom
fix-global-intl-polyfills

Conversation

@erral

@erral erral commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

This PR improves date formatting across Plone patterns and introduces a global mechanism for lazily loading polyfills and locale data.

Key Changes

  • Locale-Sensitive Formatting: Updated formatDate in pat-filemanager to respect the Plone site language from <html lang='...'> (normalized for Intl).
  • Lazy Intl Polyfills: Added src/core/intl-loader.js which detects if the browser natively supports the current locale. If not, it lazily fetches the @formatjs/intl-datetimeformat polyfill and specific locale data chunks. This ensures languages like Basque (eu) are correctly supported even in limited environments.
  • Pattern Integration: The polyfill loader is now part of the initialization for pat-filemanager, pat-contentbrowser, and pat-structure.
  • Build Support: Configured Webpack aliases to handle dynamic imports of locale data smoothly, enabling clean builds and efficient chunking.
  • Functional Testing: Added src/core/intl-loader.test.js verifying 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.

@erral erral requested review from MrTango and petschki and removed request for petschki June 17, 2026 13:22
Comment thread src/pat/filemanager/src/App.svelte
@MrTango

MrTango commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@erral when you have time, please have another look at this ;)

Co-authored-by: Maik Derstappen <md@derico.de>
@erral

erral commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

@MrTango I have tested it and it works with your changes too.

@MrTango MrTango merged commit 3434c84 into master Jul 2, 2026
3 checks passed
@MrTango MrTango deleted the fix-global-intl-polyfills branch July 2, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants