Skip to content

Conversation

@Artur-
Copy link
Member

@Artur- Artur- commented Jan 5, 2026

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

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.
@Artur- Artur- force-pushed the message-list-full-locale branch from 035e9e5 to bb84139 Compare January 5, 2026 14:24
Artur- and others added 3 commits January 5, 2026 17:23
…ests/src/test/java/com/vaadin/flow/component/messages/tests/MessageListIT.java

Co-authored-by: Diego Cardoso <diego@vaadin.com>
…ests/src/main/java/com/vaadin/flow/component/messages/tests/MessageListPage.java

Co-authored-by: Diego Cardoso <diego@vaadin.com>
Store the result of locale.split('-') in a variable to avoid calling
it twice when building the fallback locale array.
@DiegoCardoso DiegoCardoso enabled auto-merge (squash) January 7, 2026 09:55
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

@DiegoCardoso DiegoCardoso merged commit ff0e062 into main Jan 7, 2026
5 checks passed
@DiegoCardoso DiegoCardoso deleted the message-list-full-locale branch January 7, 2026 10:08
vaadin-bot pushed a commit that referenced this pull request Jan 7, 2026
* 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>
vaadin-bot pushed a commit that referenced this pull request Jan 7, 2026
* 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>
DiegoCardoso added a commit that referenced this pull request Jan 7, 2026
…8420)

* 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



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



* 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: Artur Signell <artur@vaadin.com>
Co-authored-by: Diego Cardoso <diego@vaadin.com>
DiegoCardoso added a commit that referenced this pull request Jan 7, 2026
…CP: 24.9) (#8421)

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

* 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>

* refactor: remove use of API not available in Java 17

---------

Co-authored-by: Artur Signell <artur@vaadin.com>
Co-authored-by: Diego Cardoso <diego@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MessageList breaks when using Locale Variants [1 DAY]

4 participants