[build] add typescript compiler (#2697)

This commit is contained in:
neverland
2019-02-07 10:43:36 +08:00
committed by GitHub
parent 3e0ac872c8
commit 0fb1083b68
11 changed files with 85 additions and 16 deletions
+10
View File
@@ -0,0 +1,10 @@
import { get, camelize } from '..';
import { lang, messages } 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);
return typeof message === 'function' ? message(...args) : message;
};
};