Skip to content

Conversation

@h3nn1-ship-it
Copy link

Description

As discussed here #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

#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. 😌

@coveralls
Copy link

Coverage Status

coverage: 90.828% (-0.04%) from 90.869%
when pulling b0f56b7 on henrikhertler:move-does-not-exist-log
into 3fc33c1 on toonvanstrijp:main.

@toonvanstrijp
Copy link
Owner

@henrikhertler thanks for your contribution! All tests are passing, and this addition will for sure help keep your logs clean! 🎉

@toonvanstrijp
Copy link
Owner

@rubiin I don't have time to make a release, can you please do it? 🙇🏻 👀

@toonvanstrijp toonvanstrijp requested a review from rubiin November 27, 2023 12:40
@rubiin
Copy link
Collaborator

rubiin commented Nov 27, 2023

@rubiin I don't have time to make a release, can you please do it? 🙇🏻 👀

sure thing

@rubiin rubiin merged commit da1e793 into toonvanstrijp:main Nov 27, 2023
@err0x1a
Copy link

err0x1a commented Jan 11, 2024

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)?

@h3nn1-ship-it
Copy link
Author

@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.

@err0x1a
Copy link

err0x1a commented Jan 15, 2024

@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

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.

5 participants