- 当前 Bug 的表现(可附上截图)
IOS中可获取到正常的语言版本 安卓中无论微信设置语言 还是系统设置语言 每次获取到的语言都是中文
app.js
- 预期表现
获取到英文
- 复现路径
//app.js
onShow(){
let that = this;
wx.getSystemInfo({
success: function(res) {
console.log('System:',res);
let language = res.language;
switch(language){
case 'en': //英文
that.globalData.language = (require('./utils/language/en.js')).lang
that.globalData.locale = 'en_US'
break;
case 'zh': //简体中文
that.globalData.language = (require('./utils/language/zh.js')).lang
that.globalData.locale = 'en_CN'
break;
case 'zh_CN': //简体中文
that.globalData.language = (require('./utils/language/zh.js')).lang
that.globalData.locale = 'en_CN'
break;
case 'zh_TW': //繁体台湾
that.globalData.language = (require('./utils/language/zh_CT.js')).lang
that.globalData.locale = 'en_CN'
break;
case 'zh_HK': //繁体香港
that.globalData.language = (require('./utils/language/zh_CT.js')).lang
that.globalData.locale = 'en_CN'
break;
default: //默认英文
that.globalData.language = (require('./utils/language/en.js')).lang
that.globalData.locale = 'en_US'
break;
}
},
});
- 提供一个最简复现 Demo
微信小程序开发问题解答
微信小程序开发者回答:
Android 切换了语言后,重启微信或者重启手机再试试呢?
本文网址:http://www.91bianli.com/weixinxiaochengxu/42164.html