设置Vaadin应用程序的默认语言环境

tua*_*zku 2 locale vaadin

也许这个问题被问到但我找不到.我是Vaadin的新手.如何为Vaadin应用程序设置默认语言环境.

Cha*_*ony 6

Vaadin 6:应用程序#setLocale(Locale)

Vaadin 7:VaadinSession #setLocale(Locale)例如VaadinSession.getCurrent().setLocale();

Vaadin 7的示例代码,可以在initUI方法中使用.

Locale locale = Locale.CANADA_FRENCH;
this.setLocale( locale ); // Call to affect this current UI. Workaround for bug/issue: http://dev.vaadin.com/ticket/12350
this.getSession().setLocale( locale ); // Affects only future UI instances, not current one. See workaround in line above.
// VaadinSession.getCurrent().setLocale( locale ); // Alternative to "this.getSession".
Run Code Online (Sandbox Code Playgroud)