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

Downgrade No resolvers provided! error to info level #680

Open
5 tasks done
Woodz opened this issue Dec 10, 2024 · 1 comment
Open
5 tasks done

Downgrade No resolvers provided! error to info level #680

Woodz opened this issue Dec 10, 2024 · 1 comment

Comments

@Woodz
Copy link

Woodz commented Dec 10, 2024

Describe the bug

Currently if no resolvers are configured, the following error will be logged on startup:
No resolvers provided! nestjs-i18n won't work properly, please follow the quick-start guide: https://nestjs-i18n.com/quick-start

However, it looks like resolvers are optional since target language can be specified manually in each request. Assuming that resolvers are optional, it is incorrect to report this as an error because it does not stop the system from working. It is not even a warning (since it doesn't fallback to using a default resolver). Instead this should be an info level message to inform the user about how nestjs-i18n is configured

Reproduction

#472 (comment)

System Info

System:
    OS: macOS 13.5.2
    CPU: (8) arm64 Apple M2
    Memory: 59.56 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.4 - ~/.nvm/versions/node/v18.20.4/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v18.20.4/bin/npm
  Browsers:
    Chrome: 131.0.6778.109
    Safari: 16.6

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@Woodz
Copy link
Author

Woodz commented Dec 10, 2024

As a temporary workaround I created a no-op resolver to suppress this error message:

    I18nModule.forRoot({
      fallbackLanguage: 'en',
      loaderOptions: {
        path: path.join(__dirname, '/i18n/'),
        watch: true,
      },
      // TechDebt: No-op resolver to suppress error message `No resolvers provided!` (see https://github.com/toonvanstrijp/nestjs-i18n/issues/680)
      resolvers: [{ resolve: (): undefined => undefined }],
    }),

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

No branches or pull requests

1 participant