diff --git a/lang.js b/lang.js index 0223646bf5..1997ce1ded 100644 --- a/lang.js +++ b/lang.js @@ -39,7 +39,20 @@ var isWin = /^win/.test(os.platform()); var espoPath = path.dirname(fs.realpathSync(__filename)) + ''; var resLang = process.argv[2] || 'lang_LANG'; -var poPath = process.argv[3] || espoPath + '/build/' + 'espocrm-' + resLang +'.po'; + +var poPath = espoPath + '/build/' + 'espocrm-' + resLang +'.po'; + +var onlyModuleName = null; +if (process.argv.length > 2) { + for (var i in process.argv) { + if (~process.argv[i].indexOf('--module=')) { + onlyModuleName = process.argv[i].substr(('--module=').length); + } + if (~process.argv[i].indexOf('--path=')) { + poPath = process.argv[i].substr(('--path=').length); + } + } +} var deleteFolderRecursive = function (path) { var files = []; @@ -68,6 +81,10 @@ function Lang (poPath, espoPath) { this.currentPath = path.dirname(fs.realpathSync(__filename)) + '/'; this.moduleList = ['Crm']; + if (onlyModuleName) { + this.moduleList = [onlyModuleName]; + } + this.baseLanguage = 'en_US'; var dirNames = this.dirNames = {}; @@ -78,12 +95,6 @@ function Lang (poPath, espoPath) { var dirs = [coreDir]; dirNames[coreDir] = 'application/Espo/Resources/i18n/' + resLang + '/'; - this.moduleList.forEach(function (moduleName) { - var dir = this.espoPath + 'application/Espo/Modules/' + moduleName + '/Resources/i18n/' + this.baseLanguage + '/'; - dirs.push(dir); - dirNames[dir] = 'application/Espo/Modules/' + moduleName + '/Resources/i18n/' + resLang + '/'; - }, this); - var installDir = this.espoPath + 'install/core/i18n/' + this.baseLanguage + '/'; dirs.push(installDir); dirNames[installDir] = 'install/core/i18n/' + resLang + '/'; @@ -93,6 +104,16 @@ function Lang (poPath, espoPath) { dirs.push(templatesDir); dirNames[templatesDir] = 'application/Espo/Core/Templates/i18n/' + resLang + '/'; + if (onlyModuleName) { + dirs = []; + } + + this.moduleList.forEach(function (moduleName) { + var dir = this.espoPath + 'application/Espo/Modules/' + moduleName + '/Resources/i18n/' + this.baseLanguage + '/'; + dirs.push(dir); + dirNames[dir] = 'application/Espo/Modules/' + moduleName + '/Resources/i18n/' + resLang + '/'; + }, this); + this.dirs = dirs; }; diff --git a/po.js b/po.js index 750e9f6079..4b525411a3 100644 --- a/po.js +++ b/po.js @@ -37,8 +37,20 @@ var language = process.argv[2]; var espoPath = path.dirname(fs.realpathSync(__filename)) + ''; +var onlyModuleName = null; +if (process.argv.length > 2) { + for (var i in process.argv) { + if (~process.argv[i].indexOf('--module=')) { + onlyModuleName = process.argv[i].substr(('--module=').length); + } + } +} + function PO (espoPath, language) { this.moduleList = ['Crm']; + if (onlyModuleName) { + this.moduleList = [onlyModuleName]; + } this.baseLanguage = 'en_US'; this.language = language || this.baseLanguage; @@ -56,6 +68,11 @@ function PO (espoPath, language) { this.path + 'install/core/i18n/', this.path + 'application/Espo/Core/Templates/i18n/' ]; + + if (onlyModuleName) { + dirs = []; + } + this.moduleList.forEach(function (moduleName) { dirs.push(this.path + 'application/Espo/Modules/' + moduleName + '/Resources/i18n/'); }, this);