IBM Worklight - WL.App.getDeviceLanguage() API 方法在 iOS 中没有返回正确的语言代码 [英] IBM Worklight - WL.App.getDeviceLanguage() API method does not return correct language code in iOS

查看:17
本文介绍了IBM Worklight - WL.App.getDeviceLanguage() API 方法在 iOS 中没有返回正确的语言代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS 中,尽管更改了语言设置,WL.App.getDeviceLanguage() 总是返回 en.
在 iPhone 5、iPad 4 和多个模拟器上测试.

In iOS, despite changing the language settings WL.App.getDeviceLanguage() always returns en.
Tested on iPhone 5, iPad 4 and several emulators.

如果使用 navigator.globalization.getPreferredLanguage 可以在 iOS 中正确检测语言.但是应用程序似乎不知道它在其他语言下,例如法语,所以应用程序名称本地字符串仍然是英文,即使其他语言可用.

If use navigator.globalization.getPreferredLanguage could detect language correctly in iOS. But the application seems not know it is under other language such as French so application name local string is still in English even other language is available.

推荐答案

使用iOS时,相关设置为Region Format.

When using iOS, the relevant setting is that of Region Format.

  1. 使用 iPhone 和 Android 环境创建了一个新的 Worklight 项目和应用程序
  2. wlCommonInit()中添加:alert(WL.App.getDeviceLanguage());
  3. 全部构建并部署,在设备中启动

在 iOS 中
有两个与语言相关的设置:

In iOS
There are two settings related to language:

  1. Settings.app >>一般>>国际>>区域格式

我目前选择了希伯来语(以色列).
启动应用程序会向我显示带有 he 的警报.

I currently have Hebrew (Israel) selected.
Launching the app shows me an alert with he.

更改为 Gusii (Kenya) 并重新启动应用程序然后显示 gu 等其他区域格式.

Changing to Gusii (Kenya) and re-launching the app then shows me gu, and so on for other region formats.

Settings.app >>一般>>国际>>语言

此处所做的更改不会生效.

Changes done here will take no effect.


在 Android 中
与语言相关的设置只有一个:


In Android
There is only one setting related to language:

  1. 设置>>语言和输入法

我目前选择了 עברית(希伯来语).
启动应用程序会向我显示带有 iw 的警报.

I currently have עברית (Hebrew) selected.
Launching the app shows me an alert with iw.

更改为 英语(美国) 并重新启动应用程序然后显示 en,以此类推其他语言.

Changing to English (United States) and re-launching the app then shows me en, and so on for other languages.

这篇关于IBM Worklight - WL.App.getDeviceLanguage() API 方法在 iOS 中没有返回正确的语言代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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