vaadin / flow-components

Java counterpart of Vaadin Web Components
100 stars 66 forks source link

feat: add i18n error message support for TextField #6343

Closed vursen closed 2 months ago

vursen commented 3 months ago

Description

The PR introduces TextFieldI18n with methods for setting error messages and updates the TextField's validation logic to show these error messages when validation fails.

[!NOTE] It's still possible to use the setErrorMessage method to configure a single static error message. This error message will be displayed for all constraints and will take priority over any i18n error messages that are also set. However, when more than one error message is needed, i18n should be used or manual validation mode should be enabled.

Depends on

Part of #4618

Type of change

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

vursen commented 2 months ago

During our internal discussion, we discovered a way to keep error messages that are set with setErrorMessage. They now take priority over i18n error messages, which allows developers to continue using the old familiar method, setting a single error message for all constraints. I've updated the PR and also removed the breaking change mark.

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

vaadin-bot commented 2 months ago

This ticket/PR has been released with Vaadin 24.5.0.alpha6 and is also targeting the upcoming stable 24.5.0 version.