i18next / i18next-parser

Parse your code to extract translation keys/values and manage your catalog files
MIT License
472 stars 192 forks source link

Since 8.9.0, parsing is ignoring files outside the configuration file folder. #939

Closed giovannetti-eric closed 2 months ago

giovannetti-eric commented 10 months ago

💥 Regression Report

I'm using NextJS, with Turborepo

My file structure is like:

My configuration file:

module.exports = {
  contextSeparator: false,
  createOldCatalogs: false,
  defaultNamespace: "app",
  defaultValue: "",
  indentation: 2,
  keepRemoved: false,
  keySeparator: false,
  lineEnding: "auto",
  locales: ["en"],
  namespaceSeparator: false,
  output: "./dist/keys/$NAMESPACE.json",
  pluralSeparator: "_",
  input: [
    "../../apps/**/*{.tsx,.ts,.js}",
    "../../packages/**/*{.tsx,.ts,.js}",
  ],
  sort: true,
  skipDefaultValues: false,
  useKeysAsDefaultValue: false,
  verbose: false,
  failOnWarnings: false,
  failOnUpdate: false,
  customValueTemplate: null,
  resetDefaultValueLocale: null,
  i18nextOptions: null,
  yamlOptions: null,
};

Before 8.9.0, running i18next -c ./i18next-parser.app.config.js was parsing all related files in apps and packages folders. Now, only files into i18n folder are parsed.

Last working version

Worked up to version: 8.8.0

Stopped working in version: 8.9.0

Expected behavior

The input parameter should allow me to parse files outside the configuration file folder.

Your Environment

daniellockyer commented 10 months ago

We've also run into this at Ghost - the commit above is the revert back to v8.8.0

daniellockyer commented 7 months ago

@karellm Is this issue a bug, or an intentional breaking change? We've had to pause all updates to i18next-parser due to this

donskov commented 7 months ago

Such a problem also appeared. Any progress?

crispclean commented 7 months ago

Also bumped into this issue.

moonray commented 7 months ago

Same issue. I had to downgrade to 8.8.0 Is there a breaking tweak to config necessary? Changelog did not mention anything.

moonray commented 7 months ago

To follow up, I use a monorepo. This is what my i18next-parser.config.js looks like

module.exports = {
  contextSeparator: '_',
  createOldCatalogs: false,
  defaultNamespace: 'translation',
  defaultValue: (locale, namespace, key) => {
    if (locale === 'en-US') {
      return key;
    }
    return '__NOT_TRANSLATED__';
  },
  indentation: 2,
  keepRemoved: false
  keySeparator: false,
  lexers: {
    js: ['JavascriptLexer'],
    ts: ['JavascriptLexer'],
    jsx: ['JsxLexer'],
    tsx: ['JsxLexer'],
    default: ['JavascriptLexer'],
  },
  lineEnding: 'auto',
  locales: ['en-US', 'nl-NL'],
  namespaceSeparator: false,
  output: '../../locales/$LOCALE.json',
  pluralSeparator: '____',
  input: '../*/src/**/*.{js,ts,jsx,tsx}',
  sort: false,
  skipDefaultValues: false,
  useKeysAsDefaultValue: false,
  verbose: false,
  failOnWarnings: false,
  customValueTemplate: null,
};
karellm commented 7 months ago

It's not intentional but have limited time to look at it currently. If someone can open a PR that would be greatly appreciated.

moonray commented 3 months ago

This seems to be working again in 8.13.0 @giovannetti-eric I would give this another go

13eel commented 3 months ago

This seems to be working again in 8.13.0 @giovannetti-eric I would give this another go

I kept having the same problem with 8.13.0, will still be using 8.8.0

giovannetti-eric commented 2 months ago

I have not tested the 8.13.0 but the 9.0.0 seems to work as intended.