Flow locale change component

If I were to use a custom language selection component, what would I have to call to make the new Locale take effect in Vaadin and would I still have to fire a LocaleChangeEvent (and how would it be done)?

Thanks in advance,
Nik

I have to call to make the new Locale take effect in Vaadin and would I still have to fire a LocaleChangeEvent (and how would it be done)?

Basically yes. However Flow now offers [LocaleChangeEvent]
(https://vaadin.com/api/platform/13.0.0.beta1/com/vaadin/flow/i18n/LocaleChangeEvent.html) event for that (no need to create custom event)

And an Interface [LocaleChangeObserver]
(https://vaadin.com/api/platform/13.0.0.beta1/com/vaadin/flow/i18n/LocaleChangeObserver.html), which you can implement in views that are localized.

I looked at the source and it looks like UI.setLocale would be the place to put the new locale so getTranslate picks it up but how do you fire the LocaleChangeEvent? fireEvent appears to be for ComponentEvents, should the LCE be wrapped or is there a static accessor for some event bus?

Nevermind, UI.setLocale apparently also fires the event…

UI.setLocale apparently also fires the event…

Yes, it is done here

https://github.com/vaadin/flow/blob/master/flow-server/src/main/java/com/vaadin/flow/component/UI.java#L705

Hi. Do the localeChange methods on all the views that implement the LocaleChangeObserver get called when a LocaleChangeEvent is fired or is it just the ones from the current view + layout?