alexanderwallin / node-gettext

A JavaScript implementation of gettext, a localization framework.
Other
188 stars 44 forks source link

Stop printing warnings to console? #49

Closed pronebird closed 4 years ago

pronebird commented 5 years ago

Hi,

Gettext prints warnings to console notifying when it cannot find the translations. As you know, in Gettext community a lot of code relies on the source language, meaning that normally English (or any other base language) is a part of source code. Therefore when in development, Gettext prints a warning for every single translation in the source language due to the missing (In our case) English catalogue, but the keys themselves are the messages in the source language.

The current workaround is to explicitly disable {debug: false} option, and handle errors via error event. But is this somewhat desired? I think that Gettext should not be touching the console whatsoever and let developers handle errors manually via the error event.

What do you think?

jack-bliss commented 5 years ago

i agree with this - if i could set a 'source' language and then say that i'm in that source language, it shouldn't need to warn me that translations are missing since the source IS the translation

alexanderwallin commented 4 years ago

debugging was enabled by default if process.env.NODE_ENV !== 'production. I'm removing this to make it fully opt-in.

alexanderwallin commented 4 years ago

Okay now console warnings will only happen if debug is explicitly set to true. Available in v3.0.0.