mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-26 12:10:06 +08:00
5705f72fb8
* fix: make sure en|ru locale import after zh-CN * refactor: simplify code
15 lines
467 B
TypeScript
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;
|
|
}
|