rmariuzzo / Laravel-JS-Localization

🌐 Convert your Laravel messages and consume them in the front-end!
https://github.com/rmariuzzo/laravel-js-localization
MIT License
595 stars 171 forks source link

functions should return constant itself when it not defined #122

Open 1dnmr opened 6 years ago

1dnmr commented 6 years ago

Hello,

This is really critical issue, If you forget define a constant (or made typo) all js code on the page can't stop working because of error "not found". Functions Lang.get(), Lang.choise() etc should check whether constant is defined and return it if not. Not Error! This is like Laravel trans() and trans_choice() functions works.

Please fix asap.

Thank you

rmariuzzo commented 6 years ago

Hey @1dnmr! Can you add a snippet so I can reproduce. I believe that any key not found, will just restun the same key, instead of throwing an error.

1dnmr commented 6 years ago

Hi @rmariuzzo ! I think I understand this issue wrong. Js error occurs if I make typo in constants name( Unfortunately it leads to stop execution of other js.