Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18N: VaadinSession.setLocale() doesn't update locales for UIs #2926

Closed
denis-anisimov opened this issue Nov 15, 2017 · 6 comments
Closed

I18N: VaadinSession.setLocale() doesn't update locales for UIs #2926

denis-anisimov opened this issue Nov 15, 2017 · 6 comments
Assignees
Milestone

Comments

@denis-anisimov
Copy link
Contributor

I'm not sure whether this is a bug or not but I would expect that
the locale is updated being set to the VaadinSession instance for the all active UIs.

If I don't want to update locales for all UIs I use UI::setLocale only for specific UIs.

@Legioth
Copy link
Member

Legioth commented Nov 15, 2017

Maybe just remove the method?

@denis-anisimov
Copy link
Contributor Author

I'm OK with that.

But I think it's used in the impl.
When the new UI is created it gets the Locale from the session :

protected UI createAndInitUI(Class<? extends UI> uiClass,
            VaadinRequest request, VaadinSession session) {
        UI ui = ReflectTools.createInstance(uiClass);

        // Initialize some fields for a newly created UI
        ui.getInternals().setSession(session);
        ui.setLocale(session.getLocale());

@Legioth
Copy link
Member

Legioth commented Nov 15, 2017

It uses the getter, but not the setter.

@denis-anisimov
Copy link
Contributor Author

But the setter is apparently used in another place to set the Locale for the session.
Or it's final /initialized inside the session?

@caalador
Copy link
Contributor

The session could do the initialisation of the locale by itself. VaadinService could for instance call VaadinSession.initializeLocale(I18NProvider) then we wouldn't need to have a setLocale in 2 places. But then perhaps the getter should be renamed to getInitialLocale ?

@caalador
Copy link
Contributor

Or just have in the UI init the locale on doInit(VaadinRequest request, int uiId) that is called on createAndInitUI from the BootstrapHandler.
Or should we remove the set from UI and only have it used from VaadinSession?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants