Label setCaption

Hello,
first of all sorry for this simple question, but I’m a newbie in Vaadin :slight_smile:

I composed a Login-Form with a textfield for username, a password-field, a Login-button and a combobox for language-selection. Depending on the selected language I want to change the caption of the Labels by changing the Locale and using a ResourceBundle. I added a ValueChangeListener to the combobox.

My question is now:
Do I have to change all the Labels by re-setting the “setCaption” method after the “valueChanged” of the combobox was fired?
Or is it possible to let the caption of the Labels automatically change after changing the Locale?
Setting the “setImmediate” to the components does not seem to be enough.

Thanks,
Konrad

I didn’t quite understand your case. You have some Label components in the same view in which you have the login form? It is a bit unusual, although possible, to set the captions of Label components, so I hope you’re not doing something wrong there.

Yes, you need to re-set all the captions in the application after changing the language. Captions can’t be bound to a data source.

I would love to point you to the wonderful Gas Diary application that offers language choise much like in your case, but looks like our development web server is down at the moment. Just googling for “Vaadin GasDiary” should find the sources (…when the server is up). The demo is a bit old and uses its own view manager instead of Navigator, but should be viable with respect to the internationalization and language choise. The demo is on-line
here
, except that also that server is down for service at the moment as well. What a wonderful day.

Sorry, that was my fault. I mentioned “Labels” in my post, but I meant “TextFields” and their captions and also the captions of Buttons.
So when you say I have to re-set all the captions in my application after changing the language, this is exactly what I wanted to know.

Thank you very much,
Konrad