ant-design/components/_util/getLocale.tsx
Benjy Cui 5705f72fb8 fix: make sure en|ru locale import after zh-CN (#3246)
* fix: make sure en|ru locale import after zh-CN

* refactor: simplify code
2016-10-01 00:17:31 +08:00

15 lines
467 B
TypeScript

import assign from 'object-assign';
export default function getLocale(props, context, component, getDefaultLocale) {
let locale = null;
if (context && context.antLocale && context.antLocale[component]) {
locale = context.antLocale[component];
} else {
locale = getDefaultLocale();
}
// 统一合并为完整的 Locale
const result = assign({}, locale, props.locale);
result.lang = assign({}, locale.lang, props.locale.lang);
return result;
}