[英]Vaadin portlet dynamic language change
I have an Vaadin portlet wich supports "Multilanguage" that means if an user selects for eg DE in the liferay portal he will get the German translation of some portlets and if he select another language the portlet will be translated to the selected language. 我有一个支持“多语言”的Vaadin portlet,这意味着,如果用户在liferay门户中选择DE,例如,他将获得某些portlet的德语翻译,如果他选择另一种语言,则该portlet将被翻译为所选语言。 there is a problem, the user can translate the portlet only one time , if he selects another language, the portlet keeps the translated strings of the previous language , and the portlet keeps the old language till the portlets init method is reloaded.
有一个问题,用户只能翻译一次portlet,如果他选择另一种语言,则portlet保留先前语言的翻译后的字符串,而portlet保留旧的语言,直到重新加载portlet的init方法为止。 is there a way to dynamicaly change the language of the portlets components without losing the curret users state(modifications) ?
有没有一种方法可以动态地更改portlet组件的语言而又不会丢失当前用户的状态(修改)?
There is a pattern for Vaadin component translation that may apply here: Vaadin组件翻译的模式可能适用于此处:
For storing multiple translation keys into data-property (for the caption and description separately) create your own class or use Map. 要将多个转换键存储到数据属性中(分别用于标题和描述),请创建您自己的类或使用Map。
Note also that if you have data coming from the database, this pattern does not help and you have to solve that some other way. 还要注意,如果您有来自数据库的数据,则此模式无济于事,您必须以其他方式解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.