element-plus/packages/locale/index.ts
zazzaz b01a6f4e81
feat: Feature/timepicker && repeat-click directive (#289)
* feat: Feature/datepicker && repeat-click directive (#288)

* style: fix lint

* test: fix local test

* test: update test

* fix: update api to disabledHours

* chore: update

* chore: fix lint
2020-09-16 14:49:21 +08:00

24 lines
461 B
TypeScript

import defaultLang from './lang/en'
let lang = defaultLang
export const t = (path:string): string => {
let value
const array = path.split('.')
let current = lang
for (let i = 0, j = array.length; i < j; i++) {
const property = array[i]
value = current[property]
if (i === j - 1) return value
if (!value) return ''
current = value
}
return ''
}
export const use = (l): void => {
lang = l || lang
}
export default { use, t }