Skip to content

pluralResolver.getSuffixes is not a function #271

@williamdes

Description

@williamdes

🐛 Bug Report

node_modules/i18next-scanner/lib/parser.js:288
      _this.pluralSuffixes[lng] = i18nextInstance.services.pluralResolver.getSuffixes(lng);
                                                                          ^

TypeError: i18nextInstance.services.pluralResolver.getSuffixes is not a function
    at node_modules/i18next-scanner/lib/parser.js:288:75

./node_modules/.bin/i18next-scanner --config i18next-scanner.config.js

To Reproduce

$ ./node_modules/.bin/i18next-scanner --config i18next-scanner.config.js
  • i18next-scanner.config.js
const fs = require('fs');
module.exports = {
    input: [
        'src/**/*.ts',
        '!**/node_modules/**',
    ],
    output: './',
    options: {
        debug: true,
        sort: true,
        removeUnusedKeys: true,
        func: {
            list: ['i18next.t', 'i18n.t'],
            extensions: ['.js', '.ts']
        },
        lngs: ['en','fr'],
        defaultLng: 'fr',
        resource: {
            loadPath: 'src/i18n-handler/translations/{{lng}}.json',
            savePath: 'src/i18n-handler/translations/{{lng}}.json',
            jsonIndent: 4,
            lineEnding: '\n'
        },
        nsSeparator: false, // namespace separator
        keySeparator: '.', // key separator
    },
    transform: function customTransform(file, enc, done) {
        "use strict";
        const parser = this.parser;
        const content = fs.readFileSync(file.path, enc);
        let count = 0;

        parser.parseFuncFromString(content, { list: ['i18next.t', 'i18n.t'] }, (key, options) => {
            parser.set(key);
            ++count;
        });

        if (count > 0) {
            console.log(`i18next-scanner: count=${count}, file=${JSON.stringify(file.relative)}`);
        }

        done();
    }
};

Expected behavior

Extract

Your Environment

  • runtime version: Node 22
  • i18next version: 23.16.8 and 25.7.1
  • i18next-scanner 4.6.0
  • os: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions