modular-intl
Modular plan to manage international locale files. 国际化多语言文件的模块化管理方案。
Install
Install By:
npm i --save modular-intl
Then import it by:
;
Usage
You can create Application
by the API provided by modular-intl
.
; // create app with current locale languageconst app = 'name' 'en_US'; // change localeapp; // create your modulesconst m1 = app; // add locale languagem1;m1; const m2 = app;// ... // Get i18n textconst text = m1;
Customize intl
You can customize your own intl
function, e.g.
;; // custom intl with intl-messageformatconst intl = localeskey currentLocale; const app = 'name' 'en_US' intl; const m1 = app;// ... // use new intl with format optconst text = m1;
Then you can use the formatter of intl-messageformat.
See more demo code here.
License
ISC@hustcc.