martinandert / counterpart

A translation and localization library for Node.js and the browser.
MIT License
242 stars 25 forks source link

move missing string error to console and use key as fallback #42

Closed dtygel closed 7 years ago

dtygel commented 7 years ago

Hi, we are using counterpart to translate the react app 'riot-web'. It's working great!

This PR is to avoid passing to the user the "missing translation" error, since many people use the English fallback as key to simplify the task of translating.

So, the proposal is that the error is echoed in the console, while the user will simply see the string's key. If the key is the English string, the user won't even note the error if there is no interpolation or pluralization.

martinandert commented 7 years ago

Sorry, but I can accept this because a lot of tests fail when applying your change (did you try to run the specs before submitting your PR?). Also, library functions shouldn't log to the console.

Anyway, maybe https://github.com/martinandert/counterpart/commit/9008e9db9c81d8bec373e2f351e1e2d03d08070b will help you. It's part of v0.18.