|
|
|
@ -13,12 +13,12 @@ import common from './common.mjs';
@@ -13,12 +13,12 @@ import common from './common.mjs';
|
|
|
|
|
class I18N { |
|
|
|
|
|
|
|
|
|
//构造函数,设置默认配置
|
|
|
|
|
constructor(defaultLang, templateDir, langDir, buildDir, configFilename) { |
|
|
|
|
constructor(configFilename, defaultLang, templateDir, langDir, buildDir) { |
|
|
|
|
this.configFile = typeof(configFilename) != 'undefined' && configFilename ? configFilename : 'config.json'; |
|
|
|
|
this.defaultLang = typeof(defaultLang) != 'undefined' && defaultLang ? defaultLang : 'en'; |
|
|
|
|
this.templateDir = typeof(templateDir) != 'undefined' && templateDir ? templateDir : './public/template/'; |
|
|
|
|
this.langDir = typeof(langDir) != 'undefined' && langDir ? langDir : './i18n/'; |
|
|
|
|
this.buildDir = typeof(buildDir) != 'undefined' && buildDir ? buildDir : './public/'; |
|
|
|
|
this.configFile = typeof(configFilename) != 'undefined' && configFilename ? configFilename : 'config.json'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//从模板文件中解析语言占位变量,并生成语言包文件
|
|
|
|
|