Commit 1c47153e authored by baiyaaaaa's avatar baiyaaaaa Committed by GitHub

Merge pull request #865 from QingWei-Li/fix/locale-fallback

Locale: fallback default config
parents ed8fa16f a8ed14ae
......@@ -7,7 +7,7 @@
["module-resolver", {
"root": ["element-ui"],
"alias": {
"element-ui/src/locale": "element-ui/lib/locale"
"element-ui/src": "element-ui/lib"
}
}]
]
......
......@@ -36,6 +36,7 @@ if (typeof window !== 'undefined' && window.Vue) {
module.exports = {
version: '{{version}}',
locale,
install,
{{list}}
};
......
......@@ -40,6 +40,7 @@
},
"dependencies": {
"async-validator": "^1.6.6",
"deepmerge": "^1.2.0",
"throttle-debounce": "^1.0.1",
"vue-popup": "^0.2.9",
"wind-dom": "0.0.3"
......
......@@ -131,6 +131,7 @@ if (typeof window !== 'undefined' && window.Vue) {
module.exports = {
version: '1.0.0-rc.8',
locale,
install,
Pagination,
Dialog,
......
import defaultLang from 'element-ui/src/locale/lang/zh-cn';
import Vue from 'vue';
import deepmerge from 'deepmerge';
import Format from './format';
const format = Format(Vue);
let lang = defaultLang;
let merged = false;
export const $t = function(path, options) {
const vuei18n = Object.getPrototypeOf(this || Vue).$t;
if (typeof vuei18n === 'function') {
if (!merged) {
merged = true;
Vue.locale(Vue.config.lang, deepmerge(lang, Vue.locale(Vue.config.lang), { clone: true }));
}
return vuei18n.apply(this, [path, options]);
}
const array = path.split('.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment