Search code examples
javascriptreactjstranslationi18nextreact-i18next

i18next check for unused translation


I'm wondering if anyone knows of a good way / tool / package to checking for unused translations

I've seen it for rails, like i18n-tasks but nothing for react

I'm currently using react-i18next, but it could be anything that looks through your translation file

Thanks so much in advance


Solution

  • List unused translations keys

    There is i18-unused library which prints list of all unused keys for all json files.

    npm install --save-dev i18n-unused
    

    To make it work make sure you add config i18n-unused.config.js in root directory with path to your locales (localesPath) and all js files (srcPath).

    //i18n-unused.config.js
    module.exports = {
      localesPath: 'src/locales',
      srcPath: 'src',
    };
    

    Then run:

    i18n-unused display-unused