(key: string, values = {}, locale = 'zh-CN', messages: Record<string, any> = {})
| 135 | * @param {*} messages 国际化语言包 |
| 136 | */ |
| 137 | export function getI18n(key: string, values = {}, locale = 'zh-CN', messages: Record<string, any> = {}) { |
| 138 | if (!messages || !messages[locale] || !messages[locale][key]) { |
| 139 | return ''; |
| 140 | } |
| 141 | const formater = new IntlMessageFormat(messages[locale][key], locale); |
| 142 | return formater.format(values); |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * 判断当前组件是否能够设置ref |
no outgoing calls
no test coverage detected
searching dependent graphs…