提交 df3f7dc1 编写于 作者: Q qiang

fix: Language -> Locale

上级 5260b0bf
......@@ -183,8 +183,8 @@ const ui = [
'setTopWindowStyle',
'setLeftWindowStyle',
'setRightWindowStyle',
'getLanguage',
'setLanguage'
'getLocale',
'setLocale'
]
const event = [
......
......@@ -128,7 +128,7 @@ module.exports = function (pagesJson, userManifestJson, isAppView) {
name: userManifestJson.versionName,
code: userManifestJson.versionCode
},
language: userManifestJson.language
language: userManifestJson.locale
}, {
plus: userManifestJson['app-plus']
}
......
......@@ -438,8 +438,8 @@ module.exports = function (pagesJson, manifestJson, loader) {
qqMapKey = sdkConfigs.maps.qqmap.key
}
let language = manifestJson.language
language = language && language.toUpperCase() !== 'AUTO' ? language : ''
let locale = manifestJson.locale
locale = locale && locale.toUpperCase() !== 'AUTO' ? locale : ''
return `
import Vue from 'vue'
......@@ -455,7 +455,7 @@ global.__uniConfig.debug = ${manifestJson.debug === true};
global.__uniConfig.networkTimeout = ${JSON.stringify(networkTimeoutConfig)};
global.__uniConfig.sdkConfigs = ${JSON.stringify(sdkConfigs)};
global.__uniConfig.qqMapKey = ${JSON.stringify(qqMapKey)};
global.__uniConfig.language = ${JSON.stringify(language)};
global.__uniConfig.locale = ${JSON.stringify(locale)};
global.__uniConfig.nvue = ${JSON.stringify({ 'flex-direction': getFlexDirection(manifestJson['app-plus']) })}
global.__uniConfig.__webpack_chunk_load__ = __webpack_chunk_load__
${genRegisterPageVueComponentsCode(pageComponents)}
......
......@@ -16,19 +16,19 @@ const messages = {
'zh-Hant': zhHant
}
let language
let locale
if (__PLATFORM__ === 'h5') {
language = (__uniConfig.language || navigator.language)
locale = (__uniConfig.locale || navigator.language)
} else if (__PLATFORM__ === 'app-plus') {
if (typeof weex === 'object') {
language = weex.requireModule('plus').getLanguage()
locale = weex.requireModule('plus').getLanguage()
}
} else {
language = uni.getSystemInfoSync().language
locale = uni.getSystemInfoSync().language
}
export const i18n = initVueI18n(language, __PLATFORM__ === 'app-plus' || __PLATFORM__ === 'h5' ? messages : {})
export const i18n = initVueI18n(locale, __PLATFORM__ === 'app-plus' || __PLATFORM__ === 'h5' ? messages : {})
export const t = i18n.t
export const i18nMixin = i18n.mixin = {
beforeCreate () {
......
......@@ -8,7 +8,7 @@ import {
} from './interceptor'
const SYNC_API_RE =
/^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLanguage|setLanguage/
/^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale/
const CONTEXT_API_RE = /^create|Manager$/
......
import {
getLocale,
setLocale
} from 'uni-core/helpers/i18n'
export function getLanguage () {
return getLocale()
}
export function setLanguage (locale) {
return setLocale(locale)
}
export {
getLocale,
setLocale
} from 'uni-core/helpers/i18n'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册