Skip to content

Use UI locale instead of Locale.getDefault() #8

@javier-godoy

Description

@javier-godoy

Describe the bug

Instead of assigning the JVM default locale (Locale.getDefault()) allow customDisplayLocale to be null

private Locale customDisplayLocale = Locale.getDefault();

this.customDisplayLocale = displayLocale == null ? Locale.getDefault() : displayLocale;

so that you can resolve the current UI locale when needed:

Optional.ofNullable(customDisplayLocale).orElseGet(this::getLocale)

Expected behavior

The component must default to the UI locale, not to the JVM default locale. In turn, Component.getLocale fallbacks to the default locale if it could not obtain a better one.

Minimal reproducible example

No response

Add-on Version

1.0.0-SNAPSHOT

Vaadin Version

N/A

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions