Skip to content

Conversation

@vaadin-bot
Copy link
Collaborator

This PR cherry-picks changes from the original PR #8417 to branch 25.0.

Original PR description

MessageList now gracefully handles locale variants (e.g., "de-DE-hw") by implementing a progressive fallback strategy when the full locale string is not valid for Intl.DateTimeFormat:

  1. Try full locale (e.g., "de-DE-hw")
  2. Fall back to base locale (e.g., "de-DE")
  3. Fall back to language only (e.g., "de")
  4. Fall back to browser default

This prevents the component from crashing when custom locale variants are used for resource bundle customization.
Fixes #8403

* fix: add locale fallback for MessageList to handle variants (#8403)

MessageList now gracefully handles locale variants (e.g., "de-DE-hw")
by implementing a progressive fallback strategy when the full locale
string is not valid for Intl.DateTimeFormat:
1. Try full locale (e.g., "de-DE-hw")
2. Fall back to base locale (e.g., "de-DE")
3. Fall back to language only (e.g., "de")
4. Fall back to browser default

This prevents the component from crashing when custom locale variants
are used for resource bundle customization.

* Update vaadin-messages-flow-parent/vaadin-messages-flow-integration-tests/src/test/java/com/vaadin/flow/component/messages/tests/MessageListIT.java

Co-authored-by: Diego Cardoso <diego@vaadin.com>

* Update vaadin-messages-flow-parent/vaadin-messages-flow-integration-tests/src/main/java/com/vaadin/flow/component/messages/tests/MessageListPage.java

Co-authored-by: Diego Cardoso <diego@vaadin.com>

* refactor: avoid duplicate split operation in locale fallback

Store the result of locale.split('-') in a variable to avoid calling
it twice when building the fallback locale array.

---------

Co-authored-by: Diego Cardoso <diego@vaadin.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

@DiegoCardoso DiegoCardoso enabled auto-merge (squash) January 7, 2026 10:21
@DiegoCardoso DiegoCardoso merged commit a1cbd68 into 25.0 Jan 7, 2026
5 checks passed
@DiegoCardoso DiegoCardoso deleted the cherry-pick-8417-to-25.0-1767780647114 branch January 7, 2026 10:23
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.

4 participants