GWT:从服务器端获取语言环境信息? [英] GWT: get locale information from server side?

查看:230
本文介绍了GWT:从服务器端获取语言环境信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GWT以及Spring / Hibernate / AOP。我使用一个方面来发送通知电子邮件。
在我的一个方面,我想从GWT获取当前的语言环境,以便我可以将本地化的电子邮件发送给用户。
有没有办法从客户端访问GWT Locale数据?



谢谢

解决方案

http:/ /code.google.com/intl/es-ES/webtoolkit/doc/latest/DevGuideI18nLocale.html



有关于GWT中的区域设置的信息。

p>

我有两种方法:

1)无会话服务器:发送电子邮件的服务器中的方法接收



假设这个接口有一个方法:

  doStuffAndSendMails(MyObjectData myObj); 

我的建议是将其转换为

  doStuffAndSendMails(MyObjectData myObj,String localeStr); 

并以这种方式从GWT客户端调用它:

  doStuffAndSendMails(myObj,LocaleInfo.getCurrentLocale()。getAsString()); 



<2>会话感知服务器:我不知道GWT是否允许使用会话......并且...我不想使用它......但是如果你必须的话,你可以发送到服务器的客户端的语言环境,并将它存储在会话中......


I use GWT along with Spring/Hibernate/AOP. I use an Aspect to send notification emails. In one of my Aspect, I want to get the current locale from GWT,so that I can send the localized email to the user. Is there a way to access GWT Locale data from the client side?

Thanks

解决方案

http://code.google.com/intl/es-ES/webtoolkit/doc/latest/DevGuideI18nLocale.html

has info about Locales in GWT.

I have two approaches:

1) session-less server: the method in the server that sends the email receives the locale from the client.

Let's say the interface has a method:

doStuffAndSendMails(MyObjectData myObj);

My proposal is to convert it to

doStuffAndSendMails(MyObjectData myObj, String localeStr);

and call it from the GWT client in this way:

doStuffAndSendMails(myObj, LocaleInfo.getCurrentLocale().getAsString());

2) session-aware server: I don't know if GWT allows using session... and... I prefer not to use it... but if you have to, you can send to the server the locale of the client and store it in the session...

这篇关于GWT:从服务器端获取语言环境信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆