var systemLan = "vi-CN"
try {
var res = uni.getSystemInfoSync();
console.log('系统语言', res)
systemLan = res.language
} catch (e) {}
- 发布:2021-11-17 15:41
- 更新:2021-11-17 15:41
- 阅读:505
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10 企业版64位 LTSC
HBuilderX类型: 正式
HBuilderX版本号: 3.2.12
手机系统: Android
手机系统版本号: Android 9.0
手机厂商: 三星
手机机型: SM-G9500
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
App下载地址或H5⽹址: http://power.xflaidian.com/apk/Espot.apk
操作步骤:
预期结果:
{
"errMsg": "getSystemInfoSync:ok",
"brand": "samsung",
"model": "SM-G9500",
"pixelRatio": 3,
"screenWidth": 360,
"screenHeight": 692,
"windowWidth": 360,
"windowHeight": 692,
"statusBarHeight": 24,
"language": "vi-CN",
"system": "Android 9",
"version": "1.9.9.81096",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 360,
"top": 24,
"bottom": 692,
"width": 360,
"height": 668
},
"safeAreaInsets": {
"top": 24,
"right": 0,
"bottom": 0,
"left": 0
},
"deviceId": "7D8D78A6804A7BF358DC2DC91256B478"
}
{
"errMsg": "getSystemInfoSync:ok",
"brand": "samsung",
"model": "SM-G9500",
"pixelRatio": 3,
"screenWidth": 360,
"screenHeight": 692,
"windowWidth": 360,
"windowHeight": 692,
"statusBarHeight": 24,
"language": "vi-CN",
"system": "Android 9",
"version": "1.9.9.81096",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 360,
"top": 24,
"bottom": 692,
"width": 360,
"height": 668
},
"safeAreaInsets": {
"top": 24,
"right": 0,
"bottom": 0,
"left": 0
},
"deviceId": "7D8D78A6804A7BF358DC2DC91256B478"
}
实际结果:
{
"errMsg": "getSystemInfoSync:ok",
"brand": "samsung",
"model": "SM-G9500",
"pixelRatio": 3,
"screenWidth": 360,
"screenHeight": 692,
"windowWidth": 360,
"windowHeight": 692,
"statusBarHeight": 24,
"language": "zh-CN",
"system": "Android 9",
"version": "1.9.9.81096",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 360,
"top": 24,
"bottom": 692,
"width": 360,
"height": 668
},
"safeAreaInsets": {
"top": 24,
"right": 0,
"bottom": 0,
"left": 0
},
"deviceId": "7D8D78A6804A7BF358DC2DC91256B478"
}
{
"errMsg": "getSystemInfoSync:ok",
"brand": "samsung",
"model": "SM-G9500",
"pixelRatio": 3,
"screenWidth": 360,
"screenHeight": 692,
"windowWidth": 360,
"windowHeight": 692,
"statusBarHeight": 24,
"language": "zh-CN",
"system": "Android 9",
"version": "1.9.9.81096",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 360,
"top": 24,
"bottom": 692,
"width": 360,
"height": 668
},
"safeAreaInsets": {
"top": 24,
"right": 0,
"bottom": 0,
"left": 0
},
"deviceId": "7D8D78A6804A7BF358DC2DC91256B478"
}
bug描述:
uni.getSystemInfoSync(); 三星港版手机 型号SM-G9500 在App.vue 里 onShow 里获取 系统语言 中文,英文 可以获取 如果把手机系统语言改成 越南语言 , uni.getSystemInfoSync(); 获取的系统语言默认是 "language": "zh-CN", 其他安卓手机 测试了好几个手机 vivo,oppo 都获取语言正常"language": "vi-CN", ,唯独 三星港版手机 型号SM-G9500,