How to use embark-i18n - 10 common examples

To help you get started, we’ve selected a few embark-i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github embark-framework / embark / packages / embark / src / cmd / cmd.js View on Github external
upload() {
    program
      .command('upload [environment]')
      //.option('--ens [ensDomain]', __('ENS domain to associate to'))
      .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, 'info')
      .option('--locale [locale]', __('language to use (default: en)'))
      .option('-c, --client [client]', __('Use a specific ethereum client [%s] (default: %s)', 'geth, parity', 'geth'))
      .option('--pipeline [pipeline]', __('webpack config to use (default: production)'))
      .description(__('Upload your dapp to a decentralized storage') + '.')
      .action(function (env, _options) {
        setOrDetectLocale(_options.locale);
        if (env === "ipfs" || env === "swarm") {
          console.warn(("did you mean " + "embark upload".bold + " ?").underline);
          console.warn("In embark 3.1 forwards, the correct command is embark upload  and the provider is configured in config/storage.js");
        }
        _options.env = env || 'development';
        _options.ensDomain = _options.ens;
        _options.logFile = _options.logfile; // fix casing
        _options.logLevel = _options.loglevel; // fix casing
        _options.webpackConfigName = _options.pipeline || 'production';
        embark.upload(_options);
      });
  }
github embark-framework / embark / packages / embark / src / cmd / cmd.js View on Github external
upload() {
    program
      .command('upload [environment]')
      //.option('--ens [ensDomain]', __('ENS domain to associate to'))
      .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)'))
      .option('-c, --client [client]', __('Use a specific ethereum client [%s] (default: %s)', 'geth, parity', 'geth'))
      .option('--pipeline [pipeline]', __('webpack config to use (default: production)'))
      .description(__('Upload your dapp to a decentralized storage') + '.')
      .action(function(env, _options) {
        setOrDetectLocale(_options.locale);
        if (env === "ipfs" || env === "swarm") {
          console.warn(("did you mean " + "embark upload".bold + " ?").underline);
          console.warn("In embark 3.1 forwards, the correct command is embark upload  and the provider is configured in config/storage.js");
        }
        _options.env = env || 'development';
        _options.ensDomain = _options.ens;
        _options.logFile = _options.logfile; // fix casing
        _options.logLevel = _options.loglevel; // fix casing
        _options.webpackConfigName = _options.pipeline || 'production';
        embark.upload(_options);
      });
  }
github embark-framework / embark / packages / plugins / rpc-manager / src / lib / eth_signTypedData.ts View on Github external
// - eth_signTypedData_v4
    // - personal_signTypedData (parity)
    if (!params.request.method.includes("signTypedData")) {
      return callback(null, params);
    }

    this.logger.trace(__(`Modifying blockchain '${params.request.method}' response:`));
    this.logger.trace(__(`Original request/response data: ${JSON.stringify({ request: params.request, response: params.response })}`));

    try {
      const accounts = await this.accounts;
      const [fromAddr, typedData] = params.request.params;
      const account = accounts.find((acc) => Web3.utils.toChecksumAddress(acc.address) === Web3.utils.toChecksumAddress(fromAddr));
      if (!(account && account.privateKey)) {
        return callback(
          new Error(__("Could not sign transaction because Embark does not have a private key associated with '%s'. " +
            "Please ensure you have configured your account(s) to use a mnemonic, privateKey, or privateKeyFile.", fromAddr)));
      }
      const toSign = transaction.getToSignHash(typeof typedData === "string" ? JSON.parse(typedData) : typedData);
      const signature = sign(toSign, [account.privateKey]);

      params.response.result = signature[0];
      this.logger.trace(__(`Modified request/response data: ${JSON.stringify({ request: params.request, response: params.response })}`));
    } catch (err) {
      return callback(err);
    }
    callback(null, params);
  }
}
github embark-framework / embark / packages / stack / webserver / src / index.js View on Github external
this.events.setCommandHandler('webserver:start', (cb) => {
      this.logger.warn(__("The event 'webserver:start' has been deprecated and will be removed in future versions."));
      this.events.request('processes:launch', 'webserver', cb);
    });
    // TODO: remove this in v5
github embark-framework / embark / packages / embark / src / cmd / cmd.js View on Github external
versionCmd() {
    program
      .command('version')
      .description(__('output the version number'))
      .action(function () {
        console.log(embark.version);
        process.exit(0);
      });
  }
github embark-framework / embark / packages / embark / src / cmd / cmd.js View on Github external
versionCmd() {
    program
      .command('version')
      .description(__('output the version number'))
      .action(function() {
        console.log(embark.version);
        process.exit(0);
      });
  }
github embark-framework / embark / packages / core / core / src / utils / template_generator.js View on Github external
async download(url, tmpFilePath, browse) {
    console.log(__('Installing template from ' + browse).green);
    console.log(__('Downloading template...').green);
    fs.mkdirpSync(path.dirname(tmpFilePath));
    try {
      await promisify(downloadFile)(url, tmpFilePath);
    } catch (e) {
      console.error(errorMessage(e).red);
      throw e;
    }
  }
github embark-framework / embark / packages / core / core / src / config.ts View on Github external
(/rinkeby|testnet|livenet/).test(this.blockchainConfig.networkType) &&
      !(this.blockchainConfig.accounts && this.blockchainConfig.accounts.find(acc => acc.password)) &&
      !this.blockchainConfig.isDev &&
      this.env !== 'development' && this.env !== 'test') {
      this.logger.warn((
        '\n=== ' + __('Cannot unlock account - account config missing').bold + ' ===\n' +
        __('Geth is configured to sync to a testnet/livenet and needs to unlock an account ' +
          'to allow your dApp to interact with geth, however, the address and password must ' +
          'be specified in your blockchain config. Please update your blockchain config with ' +
          'a valid address and password: \n') +
        ` - config/blockchain.js > ${this.env} > account\n\n`.italic +
        __('Please also make sure the keystore file for the account is located at: ') +
        '\n - Mac: ' + `~/Library/Ethereum/${this.env}/keystore`.italic +
        '\n - Linux: ' + `~/.ethereum/${this.env}/keystore`.italic +
        '\n - Windows: ' + `%APPDATA%\\Ethereum\\${this.env}\\keystore`.italic) +
        __('\n\nAlternatively, you could change ' +
          `config/blockchain.js > ${this.env} > networkType`.italic +
          __(' to ') +
          '"custom"\n'.italic).yellow
      );
      this.shownNoAccountConfigMsg = true;
    }

    const accountDocsMessage = __('For more info, check the docs: %s', 'https://embark.status.im/docs/blockchain_accounts_configuration.html'.underline);
    if (this.blockchainConfig.account) {
      this.logger.error(__('The `account` config for the blockchain was removed. Please use `accounts` instead.'));
      this.logger.error(accountDocsMessage);
      process.exit(1);
    }

    if (this.blockchainConfig.simulatorMnemonic) {
      this.logger.error(__('The `simulatorMnemonic` config for the blockchain was removed. Please use `accounts` instead.'));
github embark-framework / embark / packages / core / core / src / config.ts View on Github external
!this.blockchainConfig.isDev &&
      this.env !== 'development' && this.env !== 'test') {
      this.logger.warn((
        '\n=== ' + __('Cannot unlock account - account config missing').bold + ' ===\n' +
        __('Geth is configured to sync to a testnet/livenet and needs to unlock an account ' +
          'to allow your dApp to interact with geth, however, the address and password must ' +
          'be specified in your blockchain config. Please update your blockchain config with ' +
          'a valid address and password: \n') +
        ` - config/blockchain.js > ${this.env} > account\n\n`.italic +
        __('Please also make sure the keystore file for the account is located at: ') +
        '\n - Mac: ' + `~/Library/Ethereum/${this.env}/keystore`.italic +
        '\n - Linux: ' + `~/.ethereum/${this.env}/keystore`.italic +
        '\n - Windows: ' + `%APPDATA%\\Ethereum\\${this.env}\\keystore`.italic) +
        __('\n\nAlternatively, you could change ' +
          `config/blockchain.js > ${this.env} > networkType`.italic +
          __(' to ') +
          '"custom"\n'.italic).yellow
      );
      this.shownNoAccountConfigMsg = true;
    }

    const accountDocsMessage = __('For more info, check the docs: %s', 'https://embark.status.im/docs/blockchain_accounts_configuration.html'.underline);
    if (this.blockchainConfig.account) {
      this.logger.error(__('The `account` config for the blockchain was removed. Please use `accounts` instead.'));
      this.logger.error(accountDocsMessage);
      process.exit(1);
    }

    if (this.blockchainConfig.simulatorMnemonic) {
      this.logger.error(__('The `simulatorMnemonic` config for the blockchain was removed. Please use `accounts` instead.'));
      this.logger.error(accountDocsMessage);
      process.exit(1);
github embark-framework / embark / packages / plugins / geth / src / blockchain.js View on Github external
run() {
    var self = this;
    this.logger.info("===============================================================================".magenta);
    this.logger.info("===============================================================================".magenta);
    this.logger.info(__(`Embark ${this.isWhisper ? "Whisper" : "Blockchain"} using %s`, self.client.prettyName.underline).magenta);
    this.logger.info("===============================================================================".magenta);
    this.logger.info("===============================================================================".magenta);

    if (self.client.name === constants.blockchain.clients.geth) this.checkPathLength();

    let address = '';
    async.waterfall([
      function checkInstallation(next) {
        self.isClientInstalled((err) => {
          if (err) {
            return next({ message: err });
          }
          next();
        });
      },
      function init(next) {

embark-i18n

i18n Support for Embark

MIT
Latest version published 5 years ago

Package Health Score

54 / 100
Full package analysis

Popular embark-i18n functions