gpt4 book ai didi

gwt - 如何使用 LocaleInfo 获取 GWT 中的当前区域设置

转载 作者:行者123 更新时间:2023-12-02 03:48:40 24 4
gpt4 key购买 nike

我尝试使用 LocaleInfo 类和 getCurrentLocale() 方法获取客户端上的当前区域设置。但是,无论我在客户端计算机上有什么区域和区域设置,它总是返回默认区域设置值。

Date 类的 toLocaleString() 方法返回特定于区域设置的字符串,但 LocaleInfo 似乎无法获取系统区域设置。

最佳答案

要使您的 GWT 应用程序自动检测您的区域设置,只需将基本 index.html 文件(包含“nocache.js”脚本的文件)重命名为 index.jsp 并将以下行添加到该部分:

<meta name="gwt:property" content="locale=<%=request.getLocale()%>">

关于gwt - 如何使用 LocaleInfo 获取 GWT 中的当前区域设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10106973/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com