Fixed Japaneese translation.

This commit is contained in:
Ylian Saint-Hilaire 2021-06-02 10:20:31 -07:00
parent 43209e8165
commit 7d195f0108
2 changed files with 2350 additions and 2795 deletions

View File

@ -168,7 +168,7 @@ function startEx(argv) {
var command = null;
if (argv.length > 2) { command = argv[2].toLowerCase(); }
if (['minify', 'check', 'extract', 'extractall', 'translate', 'translateall', 'minifyall', 'merge', 'totext', 'fromtext'].indexOf(command) == -1) { command = null; }
if (['minify', 'check', 'extract', 'extractall', 'translate', 'translateall', 'minifyall', 'merge', 'totext', 'fromtext', 'remove'].indexOf(command) == -1) { command = null; }
if (directRun) { log('MeshCentral web site translator'); }
if (command == null) {
@ -277,6 +277,25 @@ function startEx(argv) {
extract(translationFile, meshCentralSourceFiles, translationFile);
}
// Remove a language from a translation file
if (command == 'remove') {
if (argv.length <= 3) { log('Usage: remove [language] (file)'); return; }
lang = argv[3].toLowerCase();
var translationFile = 'translate.json';
if (argv.length > 4) {
if (fs.existsSync(argv[4]) == false) { log('Unable to find: ' + argv[4]); return; } else { translationFile = argv[4]; }
}
sourceStrings = {};
if (fs.existsSync(translationFile) == false) { log('Unable to find: ' + translationFile); return; }
var langFileData = null;
try { langFileData = JSON.parse(fs.readFileSync(translationFile)); } catch (ex) { }
if ((langFileData == null) || (langFileData.strings == null)) { log("Invalid language file."); process.exit(); return; }
for (var i in langFileData.strings) { delete langFileData.strings[i][lang]; }
fs.writeFileSync(translationFile, translationsToJson({ strings: langFileData.strings }), { flag: 'w+' });
log("Done.");
return;
}
if (command == 'translateall') {
if (fs.existsSync('../views/translations') == false) { fs.mkdirSync('../views/translations'); }
//if (fs.existsSync('../public/translations') == false) { fs.mkdirSync('../public/translations'); }

File diff suppressed because it is too large Load Diff