1 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2 |
|
3 | export function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
4 | var locale = {};
|
5 |
|
6 | if (context && context.antLocale && context.antLocale[componentName]) {
|
7 | locale = context.antLocale[componentName];
|
8 | } else {
|
9 | var defaultLocale = getDefaultLocale();
|
10 |
|
11 |
|
12 | locale = defaultLocale.default || defaultLocale;
|
13 | }
|
14 |
|
15 | var result = _extends(_extends({}, locale), props.locale);
|
16 |
|
17 | result.lang = _extends(_extends({}, locale.lang), props.locale.lang);
|
18 | return result;
|
19 | }
|
20 | export function getLocaleCode(context) {
|
21 | var localeCode = context.antLocale && context.antLocale.locale;
|
22 |
|
23 | if (context.antLocale && context.antLocale.exist && !localeCode) {
|
24 | return 'zh-cn';
|
25 | }
|
26 |
|
27 | return localeCode;
|
28 | } |
\ | No newline at end of file |