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

查看:77
本文介绍了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. Build All and Deploy,在设备中启动

  1. Created a new Worklight project and application with the iPhone and Android environments
  2. Added in wlCommonInit(): alert(WL.App.getDeviceLanguage());
  3. Build All and Deploy, launch in device

在iOS

有两种与语言相关的设置:

In iOS
There are two settings related to language:


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

我目前已选择希伯来语(以色列)

启动应用程序会向我显示一条警告

更改为 Gusii (肯尼亚)并重新启动该应用程序,然后显示 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天全站免登陆