修复国际化键值的问题 (#111)

* fix(vue-common): 修复adapter中的mode的传值问题

* fix(vue-locale): 修复键值的问题
This commit is contained in:
申君健 2023-04-07 00:34:08 -07:00 committed by GitHub
parent ebafe609b6
commit 2379ee144c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 48 deletions

View File

@ -1,10 +1,5 @@
import hooks from './adapter' import hooks from './adapter'
import { import { appContext, appProperties, bindFilter, createComponent } from './adapter'
appContext,
appProperties,
bindFilter,
createComponent
} from './adapter'
import { defineAsyncComponent, directive, emitter, h, markRaw, Teleport } from './adapter' import { defineAsyncComponent, directive, emitter, h, markRaw, Teleport } from './adapter'
import { parseVnode, renderComponent, rootConfig, tools, useRouter } from './adapter' import { parseVnode, renderComponent, rootConfig, tools, useRouter } from './adapter'
import { t } from '@opentiny/vue-locale' import { t } from '@opentiny/vue-locale'
@ -115,12 +110,10 @@ export const svg = ({ name = 'Icon', component }) => {
name: $prefix + name, name: $prefix + name,
setup: (props, context) => { setup: (props, context) => {
const { fill, width, height } = context.attrs || {} const { fill, width, height } = context.attrs || {}
const extend = Object.assign( const extend = Object.assign({
{ style: { fill, width, height },
style: { fill, width, height }, class: { 'tiny-svg': true }
class: { 'tiny-svg': true } })
}
)
extend.isSvg = true extend.isSvg = true
@ -181,17 +174,7 @@ export const version = process.env.COMPONENT_VERSION
export type { PropType, ExtractPropTypes, DefineComponent } from './adapter' export type { PropType, ExtractPropTypes, DefineComponent } from './adapter'
export { export { h, hooks, directive, parseVnode, useRouter, emitter, createComponent, defineAsyncComponent, Teleport }
h,
hooks,
directive,
parseVnode,
useRouter,
emitter,
createComponent,
defineAsyncComponent,
Teleport
}
export default { export default {
h, h,

View File

@ -1,10 +1,7 @@
import * as vue from 'virtual:locale/vue' import * as vue from 'virtual:locale/vue'
import glob from './glob' import glob from './glob'
export const { use, t, i18n, initI18n, extend, zh_CN, en_US, language } = vue export const { use, t, i18n, initI18n, extend, zhCN, enUS, language } = vue
export const zhCN = zh_CN
export const enUS = en_US
export const globalization = glob(t) export const globalization = glob(t)

View File

@ -46,14 +46,11 @@ export const initI18n = ({ app, createI18n, messages = {}, i18n = {} as any, mer
merge = ({ lang, i18n, messages }) => extend.call(null, true, lang, i18n.messages, messages) merge = ({ lang, i18n, messages }) => extend.call(null, true, lang, i18n.messages, messages)
} }
const lang = { const lang = { zhCN, enUS }
'zh_CN': zhCN,
'en_US': enUS
}
if (typeof createI18n === 'function') { if (typeof createI18n === 'function') {
const vueI18n = createI18n({ const vueI18n = createI18n({
locale: i18n.locale || 'zh_CN', locale: i18n.locale || 'zhCN',
messages: merge({ lang, i18n, messages }) messages: merge({ lang, i18n, messages })
}) })
@ -73,7 +70,7 @@ export const isVue2 = true
export const isVue3 = false export const isVue3 = false
export { zhCN as zh_CN, enUS as en_US } export { zhCN, enUS }
export default { export default {
isVue2, isVue2,
@ -83,6 +80,6 @@ export default {
i18n, i18n,
initI18n, initI18n,
extend, extend,
'zh_CN': zhCN, zhCN,
'en_US': enUS enUS
} }

View File

@ -59,11 +59,11 @@ export const initI18n = ({ VueI18n, messages = {}, i18n = {} as any, merge }) =>
merge = ({ lang, i18n, messages }) => extend.call(null, true, lang, i18n.messages, messages) merge = ({ lang, i18n, messages }) => extend.call(null, true, lang, i18n.messages, messages)
} }
const lang = { 'zh_CN': zhCN, 'en_US': enUS } const lang = { zhCN, enUS }
if (typeof VueI18n === 'function') { if (typeof VueI18n === 'function') {
const vueI18n = new VueI18n({ const vueI18n = new VueI18n({
locale: i18n.locale || 'zh_CN', locale: i18n.locale || 'zhCN',
messages: merge({ lang, i18n, messages }) messages: merge({ lang, i18n, messages })
}) })
@ -83,7 +83,7 @@ export const isVue2 = true
export const isVue3 = false export const isVue3 = false
export { zhCN as zh_CN, enUS as en_US } export { zhCN, enUS }
export default { export default {
isVue2, isVue2,
@ -93,6 +93,6 @@ export default {
initI18n, initI18n,
t, t,
use, use,
'en_US': enUS, enUS,
'zh_CN': zhCN zhCN
} }

View File

@ -46,14 +46,11 @@ export const initI18n = ({ app, createI18n, messages = {}, i18n = {} as any, mer
merge = ({ lang, i18n, messages }) => extend.call(null, true, lang, i18n.messages, messages) merge = ({ lang, i18n, messages }) => extend.call(null, true, lang, i18n.messages, messages)
} }
const lang = { const lang = { zhCN, enUS }
'zh_CN': zhCN,
'en_US': enUS
}
if (typeof createI18n === 'function') { if (typeof createI18n === 'function') {
const vueI18n = createI18n({ const vueI18n = createI18n({
locale: i18n.locale || 'zh_CN', locale: i18n.locale || 'zhCN',
messages: merge({ lang, i18n, messages }) messages: merge({ lang, i18n, messages })
}) })
@ -73,7 +70,7 @@ export const isVue2 = true
export const isVue3 = false export const isVue3 = false
export { zhCN as zh_CN, enUS as en_US } export { zhCN, enUS }
export default { export default {
isVue2, isVue2,
@ -83,6 +80,6 @@ export default {
i18n, i18n,
initI18n, initI18n,
extend, extend,
'zh_CN': zhCN, zhCN,
'en_US': enUS enUS
} }