Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to supress interpolation warning #1825

Closed
wants to merge 1 commit into from

Conversation

delta-9
Copy link
Contributor

@delta-9 delta-9 commented Dec 29, 2024

Leave an option to silent interpolation warning.
And add the i18nKey to the warning message to ease debugging.

motivation::::

  • keeps logs clean during development in staging environments, in my case I got some tests suites where I want to see warnings but not these ones (for reason...).
  • if custom logic is implemented, and some warning are irrelevant, there's no way to prevent those warnings. (I don't know if that's really a thing, just want this to be merged :))

Please consider adding this option as an escape hatch, added a mention about that in the options doc below.

type option need to be added to i18next package, PR submitted with type change: i18next/i18next#2277

interface ReactOptions {
  /* .... */
  
  /**
   * Silence warning about interpolation. 
   * N.B. These warnings are relevant and you should look to fix them.
   * This option is provided as a temporary measure to ease the development phase.
   * @default undefined (false)
   */
  silentReactInterpolationWarning?: boolean;
}

docs PR i18next/react-i18next-gitbook#150

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • commit message and code follows the Developer's Certification of Origin

Checklist (for documentation change)

  • only relevant documentation part is changed (make a diff before you submit the PR)
  • motivation/reason is provided
  • commit message and code follows the Developer's Certification of Origin

@coveralls
Copy link

Coverage Status

coverage: 96.671% (-0.1%) from 96.782%
when pulling d99bc7e on delta-9:silent-interpolations-waning
into 9b194b1 on i18next:master.

@adrai adrai closed this Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants