使用DateFormat时,am / pm字符串未本地化/已翻译 [英] am/pm strings not localized/translated when using DateFormat

查看:200
本文介绍了使用DateFormat时,am / pm字符串未本地化/已翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的应用加载时,我会获取设备的设置,以便根据用户的区域设置显示日期/时间。如下图所示,模式是正确的,但是am / pm标记没有翻译成相应的语言(在这种情况下,语言是希腊语,local是el_GR)。有没有办法解决这个问题?

When my app loads, I get device's settings in order to display dates/times according to user's locale. As seen on the image below, the pattern is correct, but the am/pm marker is not translated to the corresponding language (in this case language is Greek, local is "el_GR"). Is there a way to fix that?

"am/pm" should be automatically translated to "πμ/μμ"


public static final DateFormat USER_DF_TIME = DateFormat.getDateTimeInstance(DateFormat.SHORT,
        DateFormat.SHORT, Locale.getDefault());

推荐答案

经过进一步调查,我发现Java 6存在类似的错误,瑞典语本地化具有错误的上午/下午标记。该错误已报告回来2007年终于在2011年得到解决。

After further investigation, I found a similar bug for Java 6, "Swedish localization has incorrect am/pm markers".The bug was reported back in 2007 and was finally resolved in 2011.

另外,根据官方Oracle页面支持的语言环境集在Java平台标准版(Java SE)的不同实现之间有所不同

Also, according to the official Oracle page "The set of supported locales varies between different implementations of the Java Platform Standard Edition (Java SE)".

在各种设备上测试我的代码我发现它在android 4.1.2和4.4上运行正常,但问题仍然存在于我的android 4.1.1设备上。鉴于旧版Android的Java版本与Java 6类似,我推断这是一个在较新版本中解决的Java语言问题。

Testing my code on various devices I found out that it worked correctly on android 4.1.2 and 4.4, but the problem remains for my android 4.1.1 device. Given that old android's Java version is similar to Java 6 I infer that it's a Java language problem that is solved in newer versions.

这篇关于使用DateFormat时,am / pm字符串未本地化/已翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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