How to use i18next-scanner - 4 common examples

To help you get started, we’ve selected a few i18next-scanner 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 LiskHQ / lisk-desktop / src / i18n-scanner.js View on Github external
function i18nScanner(params) { // eslint-disable-line
  const parser = new Parser({
    keySeparator: '>',
    nsSeparator: '|',
  });

  const sourceJSON = fs.readFileSync(params.outputFilePath, 'utf8');
  let translationsSource;
  try {
    translationsSource = JSON.parse(sourceJSON);
  } catch (e) {
    process.stderr.write(`i18nScanner: ${e}\n`);
    return;
  }

  const customHandler = function (key, options) {
    const value = translationsSource[key] || key;
    if (options.context) {
github cncjs / cncjs / gulp / tasks / i18next.js View on Github external
gulp.task('i18next:web', () => {
        return gulp.src(webConfig.src)
            .pipe(sort()) // Sort files in stream by path
            .pipe(i18nextScanner(webConfig.options, customTransform))
            .pipe(gulp.dest(webConfig.dest));
    });
};
github LiskHQ / lisk-mobile / scripts / scanner.config.js View on Github external
function parse(config, oldTranslations) {
  const parser = new Parser({
    keySeparator: '>',
    nsSeparator: '|',
  });

  config.files
    .map(filePattern => glob.sync(filePattern, {}))
    .reduce((accumulator, files) => [...accumulator, ...files], [])
    .forEach(file => {
      const content = fs.readFileSync(file, 'utf-8');
      parser.parseFuncFromString(
        content,
        { list: config.translationFunctionNames },
        (key, options) => customHandler(parser, oldTranslations, key, options)
      );
    });
github cheton / webappengine / gulp / tasks / i18next.js View on Github external
gulp.task('i18next:app', () => {
        return gulp.src(appConfig.src)
            .pipe(i18nextScanner(appConfig.options, customTransform))
            .pipe(gulp.dest(appConfig.dest));
    });
    gulp.task('i18next:web', () => {

i18next-scanner

Scan your code, extract translation keys/values, and merge them into i18n resource files.

MIT
Latest version published 8 months ago

Package Health Score

64 / 100
Full package analysis

Popular i18next-scanner functions