import { get } from 'lodash' ; import { template } from '../helpers/template' ; import { getLanguage } from './language' ; import { Locale } from './types' ; const LocaleMap = { } ; param locale param localeObj export function registerLocale ( locale , localeObj ) { LocaleMap [ locale ] = localeObj ; } param lang returns export function getLocale ( locale ? ) { const lang = locale || getLanguage ( ) ; return { get : ( key , obj ? ) => { return template ( get ( LocaleMap [ lang ] , key ) || get ( LocaleMap [ 'zh_CN' ] , key ) || key , obj ) ; } , } ; } export { getLanguage } from './language' ;