mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[improvement] optimize locale (#2725)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { get, camelize } from '..';
|
||||
import { lang, messages } from '../../locale';
|
||||
import locale from '../../locale';
|
||||
|
||||
export default (name: string) => {
|
||||
const prefix = camelize(name) + '.';
|
||||
return (path: string, ...args: any[]): string => {
|
||||
const message = get(messages[lang], prefix + path) || get(messages[lang], path);
|
||||
const message = get(locale.messages(), prefix + path) || get(locale.messages(), path);
|
||||
return typeof message === 'function' ? message(...args) : message;
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user