如题,java中有没有提供获取操作系统语言的API,小弟做的一个东东,提供中文和英文两种语言,
我想再java层对操作系统进行判断,如果我EN OS,则显示EN网页,反之,则显示中文网页。向各位请教!

解决方案 »

  1.   

    http://projects.apache.org/projects/jakarta_commons_lang.html
    apahce的commons工具包可能有这个功能, 我不是很确定有没有你想要的功能. 
    这里面有个类叫SystemUtils, 你自己查查帮助看看.
      

  2.   

    找到了,
    http://jakarta.apache.org/commons/lang/apidocs/index.htmlUSER_LANGUAGE
    public static final String USER_LANGUAGEThe user.language System Property. User's language code, such as "en".Defaults to null if the runtime does not have security access to read this property or the property does not exist.This value is initialized when the class is loaded. If System.setProperty(String,String) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property. 
    Since: 
    2.0, Java 1.2
      

  3.   

    使用函数System.getProperty("user.language");
    返回zh表示中文
      

  4.   

    不过我个人认为这个应该用一个applet来做,
    让客户端将class下载到本地执行,
    不然的话,class在服务端执行,那么系统属性只能获得服务器的属性,
    而不能得到客户端的属性。没有测试过,纯属个人意见。