Closed henrikhertler closed 7 months ago
@henrikhertler thanks for your contribution! All tests are passing, and this addition will for sure help keep your logs clean! 🎉
@rubiin I don't have time to make a release, can you please do it? 🙇🏻 👀
@rubiin I don't have time to make a release, can you please do it? 🙇🏻 👀
sure thing
I am still receiving the error message. Version 10.4.0.
@henrikhertler should the line this.logger.error(translationKeyMissing);
be inside the clause: if (this.i18nOptions.logging && this.i18nOptions.throwOnMissingKey)
?
@lvisb it worked for my use case, I tested it.
Just to double check: Are you sure that you properly set up a fallback language? And your translation is in the fallback language?
If yes, maybe @toonvanstrijp or @rubiin can have a look again. If you could isolate the relevant parts of your code and create a small, standalone example, that would be very helpful.
@henrikhertler Yes, I have properly set up a fallback language, and the translation is indeed in the fallback language.
I've created a small, standalone example with the relevant parts of the code for easier analysis. You can find it at this link: https://github.com/lvisb/nesti-18n-error
Description
As discussed here https://github.com/toonvanstrijp/nestjs-i18n/discussions/540: It would be nice to only print an error to the console if the translation couldn't be found in any fallback language. Therefore I created this PR.
This will prevent "polluting" logs as the system works as intended and will only log an error if no key in any fallback language is found.
Linked Issues
https://github.com/toonvanstrijp/nestjs-i18n/discussions/540
Additional context
Following the Boy Scout rule (Always leave the code you are working on a little bit better than you found it.) I also tried to make the function I touched more readable.
This is my first contribution. Feel free to remark on anything I can improve. :relieved: