You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
467 B
TypeScript
15 lines
467 B
TypeScript
8 years ago
|
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;
|
||
|
}
|