From 9a6cfd422820c1cf44937e6d08b463a84a212ffd Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 2 May 2023 18:06:33 +0300 Subject: [PATCH] cs --- lang.js | 24 +++++++++++++----------- po.js | 19 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lang.js b/lang.js index d4b7f9bae5..c9846036c1 100644 --- a/lang.js +++ b/lang.js @@ -25,14 +25,14 @@ * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ - + /** * Builds language files from a PO file. * * Command example: `node lang de_DE`. * * A PO file should be located in `build` directory: `build/espocrm-lang_CODE.po`. - * Langugae files will be created in `build` directory. + * Language files will be created in `build` directory. * * You specify a module with `--module=` parameter. It will build only for the specified module. */ @@ -45,30 +45,32 @@ if (process.argv.length < 3) { throw new Error('You need to pass a language code as a second parameter.'); } -var espoPath = path.dirname(fs.realpathSync(__filename)) + ''; -var language = process.argv[2]; +let espoPath = path.dirname(fs.realpathSync(__filename)) + ''; +let language = process.argv[2]; -var poPath = null; +let poPath = null; +let onlyModuleName = null; -var onlyModuleName = null; if (process.argv.length > 2) { - for (var i in process.argv) { + for (let i in process.argv) { if (~process.argv[i].indexOf('--module=')) { - onlyModuleName = process.argv[i].substr(('--module=').length); + onlyModuleName = process.argv[i].substring(('--module=').length); } + if (~process.argv[i].indexOf('--path=')) { - poPath = process.argv[i].substr(('--path=').length); + poPath = process.argv[i].substring(('--path=').length); } } } if (!poPath) { poPath = espoPath + '/build/' + 'espocrm-' + language; + if (onlyModuleName) { poPath += '-' + onlyModuleName; } + poPath += '.po'; } -var lang = new Lang(language, poPath, espoPath, onlyModuleName); -lang.run(); +new Lang(language, poPath, espoPath, onlyModuleName).run(); diff --git a/po.js b/po.js index ab5130827c..eb32a987eb 100644 --- a/po.js +++ b/po.js @@ -41,26 +41,27 @@ const PO = require('./js/po'); const path = require('path'); const fs = require('fs'); -var language = process.argv[2] || null; +let language = process.argv[2] || null; + +let onlyModuleName = null; -var onlyModuleName = null; if (process.argv.length > 2) { - for (var i in process.argv) { + for (let i in process.argv) { if (~process.argv[i].indexOf('--module=')) { onlyModuleName = process.argv[i].substr(('--module=').length); } + if (~process.argv[i].indexOf('--all')) { language = '--all'; } } } -var espoPath = path.dirname(fs.realpathSync(__filename)) + ''; +let espoPath = path.dirname(fs.realpathSync(__filename)) + ''; -var po = new PO(espoPath, language, onlyModuleName); +let po = new PO(espoPath, language, onlyModuleName); -if (language === '--all') { - po.runAll(); -} else { +language === '--all' ? + po.runAll() : po.run(); -} +