Skip to content

Preload en locale in component definitions#1494

Open
dpvc wants to merge 1 commit into
feature/locale-linkedomfrom
feature/locale-components
Open

Preload en locale in component definitions#1494
dpvc wants to merge 1 commit into
feature/locale-linkedomfrom
feature/locale-components

Conversation

@dpvc
Copy link
Copy Markdown
Member

@dpvc dpvc commented May 31, 2026

This PR adds files to the components/mjs subdirectories in order to pre-load the en locale definitions when the components are webpacked (or loaded into a node application). This required the addition of a #ts pseudo-path in order to be able to access the definitions from the ts directory (since they might not have been moved to the mjs or bundle directories yet).

This is done through the use of separate en.js files for each component so that it would be possible to use the webpack configuration to replace them easily with files for another locale, if a version with a different built-in default wanted to be created.

An alternative would be to move these to the ts/**/__locales__ directories and have the Component.ts files load them directly. Then even node applications with direct calls to the modules would have the default en localization automatically, and there would not be a need for the warning message if Locale.setLocale() wasn't called first. But then node applications that change the default locale will end up loading both en and the new one, whereas with the files where they are now, that would not be the case for direct module loading. I'm not sure which is the better approach.

@dpvc dpvc requested a review from zorkow May 31, 2026 14:18
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.

1 participant