Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.translate = void 0; const inquirer_1 = __importDefault(require("../utils/inquirer")); const flows_1 = require("../lib/flows"); const checks_1 = require("../utils/checks"); const progressBar_1 = require("../utils/progressBar"); const stringUtils_1 = require("../utils/stringUtils"); const translate = async ({ resourceType, resourceName, options, }) => { const { translator, apiKey, toLanguage, forceYes } = (options); if (resourceType !== 'flow') { console.log(`\Translation of resource type ${resourceType} is not supported.`); process.exit(0); } await (0, checks_1.checkLocale)(options.localeName); if (!['google', 'microsoft', 'deepl'].includes(translator)) { console.log("Please use 'google', 'microsoft' or 'deepl' as translation tool"); process.exit(0); } if (!apiKey) { console.log(`Please provide an API Key for ${translator} translate`); process.exit(0); } if (!toLanguage) { console.log(`Please provide a language to translate to (e.g. en)`); process.exit(0); } await (0, checks_1.checkProject)(); (0, checks_1.checkAgentDir)(); const answers = forceYes ? { overwrite: true } : await inquirer_1.default.prompt([ { type: 'confirm', name: 'overwrite', message: `This will irreversably overwrite data for ${(0, stringUtils_1.upperFirst)(resourceType)} ${resourceName}. Do you want to proceed?`, }, ]); if (!answers.overwrite) { console.log(`Aborting...`); return; } console.log(`\nStarting to translate Flow '${resourceName}'...\n`); await (0, flows_1.translateFlow)(resourceName, options); console.log(`\nRefreshing local Flow copy...\n`); (0, progressBar_1.startProgressBar)(100); await (0, flows_1.pullFlow)(resourceName, 50); (0, progressBar_1.endProgressBar)(); console.log(`\nWe've successfully translated Flow '${resourceName}'...\n`); return; }; exports.translate = translate; |