Vaadin 7 bean validation message language (locale)

Dear All,

I’ve already tried to post it in the Vaadin 7 section, but didn’t get any answer, so I will try here in the hope someone will come up with a suggestion.

I am prototyping with the bean validation and I am unable to show messages in proper languages. Instead always the default locale is taken.

I debugged it and the reason is in the method of the AbstractComponent#getLocale() which returns null as the locale because the field is not yet attached to the parent, but the validator is already initialized with the default (wrong) locale.

Is there any suggestion how can I plugin into the validation process to overcome the issue?

Here is my test code:

public class ValidationUI extends UI {

	protected void init(VaadinRequest request) {

		final VerticalLayout layout = new VerticalLayout();
		Project project = new Project();
		final TextField textField = new TextField("Name");
		final BeanFieldGroup<Project> fieldGroup = new BeanFieldGroup<Project>(Project.class);
		fieldGroup.bind(textField, "name");
		FormLayout formLayout = new FormLayout(textField);
		Button button = new Button("Click Me");
		button.addClickListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
				try {
					layout.addComponent(new Label("Field Locale: " + textField.getLocale()));
				} catch (CommitException e) {
					throw new RuntimeException(e);

In case somebody is still interested in the resolution.

Here is the workaround code till the issue is fixed in the frame work:

	 * Commits all changes done to the bound fields.
	 * See {@link BeanFieldGroup#commit()} 
	public void commit() {
		try {
			this.setValidationLocale(); //Workaround, set locale before commit.
		catch (CommitException exception) {
			throw new RuntimeException(exception.toString(), exception); //TODO: proper handling
	 * Workaround for the vaadin bug
	 * We set the locale manually for all {@link BeanValidator} validators.
	private void setValidationLocale() {
		Collection<Field<?>> fields = this.fieldGroup.getFields();
		for (Field<?> field : fields) {
			Collection<Validator> validators = field.getValidators();
			for (Validator validator : validators) {
				if (validator instanceof BeanValidator) {
					//ResourceManager => Own locale handling class. super.getLocale() would also work for CustomComponents 


I have the same problem. The validation messages need to be localised i.e. english, german etc.
I can’t quite see how to use the workaround above, I use BeanItem, FieldGroup and a FormLayout and simply use:

myFieldGroup.bindMemberFields(myFormLayout); The validation happens in the framework. Where (which class/object) would I add the workaround to?

I see the ticket ( is still there, although the original post linked to in the ticket in the old forum is no longer available. Is the ticket likely to be fixed any time soon?

Thanks for any help or advice.



I have the same problem. The workaround is not a practical solution. To my mind the problem didn’t exists in Vaadin 6.
Do you know, if there is a update regarding this issue?!


One more year later I face the same problem. Still no solution available?