GWT I18N在服务器端 [英] GWT I18N on the server side

查看:92
本文介绍了GWT I18N在服务器端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实现GWT服务器端国际化的最佳方式是什么?


  1. 使用本地Java属性文件(不知道如何阅读以及如何找到正确的语言文件)(unicode字符串需要ASCII编码)

  2. 使用 - GWT / N / A / GWT / N / A / GWT / N / A /模块,它可以在客户端和服务器上无缝使用GWT I18N,并使用java.lang.reflect.Proxy方法。 使用 Kotori I18N - ...


  3. 其他想法?




  4. 如何找到并传递本地化从客户端切断?



    在服务器端,我有一个Servlet,它仍然不使用任何依赖于GWT的源代码,最好是不要这样做?

    解决方案

    我发现这个解决方案,它看起来非常好

    gwt-i18n-server - 在服务器端提供对gwt i18n功能的简单支持

    < blockquote>

    目标是允许GWT开发者在服务器端使用它们的常量和消息接口(参见国际化)。该实现基于java反射api。它从类路径(与接口相同的文件夹)加载属性文件。它支持Constants,ConstantsWithLookup,Messages(也是复数)。

    客户端当前的语言环境可以这样找到:

      LocaleInfo.getCurrentLocale()。getLocaleName()


    What is the best way to implement GWT Server Side Internationalization?

    1. Use native Java properties files (not sure how to read and how to locate the right language file) (unicode string need to be ASCII encoded)

    2. Use GWTI18N.java - GWT module which gives you seamless use of GWT I18N on both the client and the server and uses "java.lang.reflect.Proxy method"

    3. Use Kotori I18N - ...

    4. Other ideas?

    How can I find and pass localization from client to sever?

    On the server side I have an Servlet which still doesn't use any GWT dependant source, is it better not to do so?

    解决方案

    I found this solution and it looks very good

    gwt-i18n-server - Provides a simple support of gwt i18n feature on the server side

    The aim is to permit to the GWT developer to use their Constants and Messages interfaces on the server side (See internationzation). The implementation is based on java reflect api. It loads the properties files from the classpath (same folder than the interface). It supports Constants, ConstantsWithLookup, Messages (plural too). The licence is LGPL.

    Client current locale can be found this way:

    LocaleInfo.getCurrentLocale().getLocaleName()
    

    这篇关于GWT I18N在服务器端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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