Module: miot/host/locale

host 的本地信息, 包括语言,时区和地理位置

Example
import {Host} from 'miot'
...
let language = Host.locale.language
let timeZone = Host.locale.timeZone
if (language === 'zh') ...
... 

Members

(static) is24HourTime :boolean

是否是24小时制计时格式

(static) language :string

获取米家 APP 语言

(static) systemLanguage

获取系统语言

(static) timeZone :string

获取时区

Methods

(static) getLocation() → {Promise}

获取手机地理位置信息 { country province city district(区域) street address latitude(纬度) longitude(经度) citycode(城市编码) adcode(区域编码) }

Returns:
Type
Promise
Example
import {Host} from 'miot'
...
Host.locale.getLocation().then(res => {
 console.log('get location: ', res)
})

(static) getSystemTimeZone() → {Promise}

获取手机的时区信息

Since:
  • 10024
Returns:
Type
Promise
Example
Host.locale.getSystemTimeZone().then...
result = {"timeZone":"Asia/Shanghai"}