Skip to content

String templates are not parsed #52

Description

@anisimov74

Thank you for the module you've created.
I have a problem with generating a .pot file for the code like
i18nPlural(issuesAmount, `${issuesAmount} issue`, `${issuesAmount} issues`).

i18nPlural is implemented with the node-gettext

No plural form generated.
Please advise.

Full source code of the extractor

const { GettextExtractor, JsExtractors } = require('gettext-extractor');
const fs = require('fs');

const dir = './translations';
if (!fs.existsSync(dir)){
  fs.mkdirSync(dir);
}
const extractor = new GettextExtractor();
extractor
  .createJsParser([
    JsExtractors.callExpression('i18n', {
      arguments: {
        text: 0,
        context: 1,
      },
    }),
    JsExtractors.callExpression('i18nPlural', {
      arguments: {
        text: 1,
        textPlural: 2,
        context: 3,
      },
    }),
  ])
  .parseFilesGlob('./src/**/!(*.spec).js');
extractor.savePotFile('./translations/default.pot');
extractor.printStats();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions