From 854fa0deb08e88c80181c82ec1d6a1a35aa75d94 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 9 May 2018 18:46:38 -0400 Subject: [PATCH] add locale option to most cmds --- lib/cmd.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/cmd.js b/lib/cmd.js index 7cbac225..8fc4b60f 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -46,7 +46,9 @@ class Cmd { .command('new [name]') .description(__('New Application')) .option('--simple', __('create a barebones project meant only for contract development')) + .option('--locale [locale]', __('language to use (default: en)')) .action(function (name, options) { + i18n.setOrDetectLocale(options.locale); if (name === undefined) { return promptly.prompt(__("Name your app (default is %s):", 'embarkDapp'), { default: "embarkDApp", @@ -79,8 +81,10 @@ class Cmd { demo() { program .command('demo') + .option('--locale [locale]', __('language to use (default: en)')) .description(__('create a working dapp with a SimpleStorage contract')) .action(function () { + i18n.setOrDetectLocale(options.locale); embark.generateTemplate('demo', './', 'embark_demo'); }); } @@ -90,8 +94,10 @@ class Cmd { .command('build [environment]') .option('--logfile [logfile]', __('filename to output logs (default: none)')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug') + .option('--locale [locale]', __('language to use (default: en)')) .description(__('deploy and build dapp at ') + 'dist/ (default: development)') .action(function (env, _options) { + i18n.setOrDetectLocale(options.locale); _options.env = env || 'development'; _options.logFile = _options.logfile; // fix casing _options.logLevel = _options.loglevel; // fix casing @@ -129,8 +135,10 @@ class Cmd { program .command('blockchain [environment]') .option('-c, --client [client]', __('Use a specific ethereum client or simulator (supported: %s)', 'geth, testrpc')) + .option('--locale [locale]', __('language to use (default: en)')) .description(__('run blockchain server (default: %s)', 'development')) .action(function (env, options) { + i18n.setOrDetectLocale(options.locale); embark.initConfig(env || 'development', { embarkConfig: 'embark.json', interceptLogs: false @@ -149,8 +157,10 @@ class Cmd { .option('-a, --accounts [numAccounts]', __('number of accounts (default: %s)', '10')) .option('-e, --defaultBalanceEther [balance]', __('Amount of ether to assign each test account (default: %s)', '100')) .option('-l, --gasLimit [gasLimit]', __('custom gas limit (default: %s)', '8000000')) + .option('--locale [locale]', __('language to use (default: en)')) .action(function (env, options) { + i18n.setOrDetectLocale(options.locale); embark.initConfig(env || 'development', { embarkConfig: 'embark.json', interceptLogs: false @@ -168,8 +178,10 @@ class Cmd { test() { program .command('test [file]') + .option('--locale [locale]', __('language to use (default: en)')) .description(__('run tests')) .action(function (file) { + i18n.setOrDetectLocale(options.locale); embark.initConfig('development', { embarkConfig: 'embark.json', interceptLogs: false }); @@ -182,8 +194,10 @@ class Cmd { .command('upload [environment]') .option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug') + .option('--locale [locale]', __('language to use (default: en)')) .description(__('Upload your dapp to a decentralized storage') + ' (e.g embark upload ipfs).') .action(function (platform, env, _options) { + i18n.setOrDetectLocale(options.locale); _options.env = env || 'development'; _options.logFile = _options.logfile; // fix casing _options.logLevel = _options.loglevel; // fix casing @@ -197,8 +211,10 @@ class Cmd { .option('--skip-undeployed', __('Graph will not include undeployed contracts')) .option('--skip-functions', __('Graph will not include functions')) .option('--skip-events', __('Graph will not include events')) + .option('--locale [locale]', __('language to use (default: en)')) .description(__('generates documentation based on the smart contracts configured')) .action(function (env, options) { + i18n.setOrDetectLocale(options.locale); embark.graph({ env: env || 'development', logFile: options.logfile, @@ -212,8 +228,10 @@ class Cmd { reset() { program .command('reset') + .option('--locale [locale]', __('language to use (default: en)')) .description(__('resets embarks state on this dapp including clearing cache')) .action(function () { + i18n.setOrDetectLocale(options.locale); embark.initConfig('development', { embarkConfig: 'embark.json', interceptLogs: false });