mirror of
https://github.com/espocrm/espocrm.git
synced 2026-03-03 02:27:01 +00:00
cs
This commit is contained in:
24
lang.js
24
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();
|
||||
|
||||
19
po.js
19
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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user