You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Ackermann (JIRA)" <ji...@apache.org> on 2017/10/13 08:31:03 UTC

[jira] [Closed] (WICKET-6472) Support Java MessageFormat for ValidationError variables

     [ https://issues.apache.org/jira/browse/WICKET-6472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Ackermann closed WICKET-6472.
----------------------------------

> Support Java MessageFormat for ValidationError variables
> --------------------------------------------------------
>
>                 Key: WICKET-6472
>                 URL: https://issues.apache.org/jira/browse/WICKET-6472
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 7.8.0
>            Reporter: Sven Ackermann
>            Assignee: Sven Meier
>
> Hi,
> it would be pretty nice if we could use the power of java.text.MessageFormat for variables in validation error messages, like so:
> {code:java}
> TextField myField = new TextField("myField");
> myField.setType(BigDecimal.class);
> myField.add(RangeValidator.range(BigDecimal.valueOf(1), BigDecimal.valueOf(100)));
> {code}
> {code}
> myField.RangeValidator.range=Value must be between ${minimum,number,#.00} and ${maximum,number,#.00} EUR.
> {code}
> At the moment, {{FormComponent.MessageSource.substitute()}} will always use the registered {{IConverter}} to format the value. In the example above this would be {{BigDecimalConverter}} which by default does not output a zero fraction. It would be overkill to overwrite the Converter just for a different formatting of the error message.
> I think the mechanism could be extended such that the {{VariableInterpolator}} will recognize commas in the variable name and then instead use MessageFormat for formatting. This should be possible without breaking existing applications, since commas are not allowed in variable names.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)