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

时间:2013-05-02 05:43:39

标签: locale vaadin

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

1 个答案:

答案 0 :(得分:6)

Vaadin 6:Application#setLocale(Locale)

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

Vaadin 7的示例代码,可能在UI的init方法中使用。

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".