Skip to content

Commit

Permalink
updated gulp file
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Nov 15, 2021
1 parent 4a60e3b commit 650a34d
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* ioBroker gulpfile
* Date: 2019-01-28
* Date: 2021-11-15
*/
'use strict';

Expand Down Expand Up @@ -35,8 +35,12 @@ async function translateNotExisting(obj, baseText, yandex) {
for (let l in languages) {
if (!obj[l]) {
const time = new Date().getTime();
obj[l] = await translate(t, l, yandex);
console.log('en -> ' + l + ' ' + (new Date().getTime() - time) + ' ms');
try {
obj[l] = await translate(t, l, yandex);
console.log('en -> ' + l + ' ' + (new Date().getTime() - time) + ' ms');
} catch (ex) {
console.log('err: ' + ex.message);
}
}
}
}
Expand Down Expand Up @@ -119,6 +123,16 @@ gulp.task('translate', async function (done) {
await translateNotExisting(iopackage.common.desc, null, yandex);
}

if (iopackage.instanceObjects) {
for (var j = 0; j < iopackage.instanceObjects.length; j++) {
if (iopackage.instanceObjects[j].common.name && typeof iopackage.instanceObjects[j].common.name === 'string') {
iopackage.instanceObjects[j].common.name = {en: iopackage.instanceObjects[j].common.name};
}

await translateNotExisting(iopackage.instanceObjects[j].common.name, null, yandex);
}
}

if (fs.existsSync('./admin/i18n/en/translations.json')) {
let enTranslations = require('./admin/i18n/en/translations.json');
for (let l in languages) {
Expand Down

0 comments on commit 650a34d

Please sign in to comment.