mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:39:05 +08:00
chore: 支持表达式多语言默认显示 (#7805)
This commit is contained in:
parent
42d43050ce
commit
2a102312f3
@ -1,6 +1,7 @@
|
||||
// 多语言支持
|
||||
import React from 'react';
|
||||
import hoistNonReactStatic from 'hoist-non-react-statics';
|
||||
import moment from 'moment';
|
||||
import {resolveVariable} from './utils/tpl-builtin';
|
||||
|
||||
export type TranslateFn<T = any> = (str: T, data?: object) => T;
|
||||
@ -11,6 +12,12 @@ interface LocaleConfig {
|
||||
|
||||
let defaultLocale: string = 'zh-CN';
|
||||
|
||||
const momentLocaleMap: Record<string, string> = {
|
||||
'zh-CN': 'zh-cn',
|
||||
'en-US': 'en',
|
||||
'de-DE': 'de'
|
||||
};
|
||||
|
||||
const locales: {
|
||||
[propName: string]: LocaleConfig;
|
||||
} = {};
|
||||
@ -154,6 +161,7 @@ export function localeable<
|
||||
locale,
|
||||
translate: translate!
|
||||
};
|
||||
moment.locale(momentLocaleMap?.[locale] ?? locale);
|
||||
const refConfig = ComposedComponent.prototype?.isReactComponent
|
||||
? {ref: this.childRef}
|
||||
: {forwardedRef: this.childRef};
|
||||
|
Loading…
Reference in New Issue
Block a user