laravel-js-localization icon indicating copy to clipboard operation
laravel-js-localization copied to clipboard

Lang.get("") returns whole object of translations

Open carestad opened this issue 6 years ago • 0 comments

When adding an empty string to Lang.get(), it returns the whole translation object for your locale.

Would expect it to just return an empty string?

E.g. Lang.get("") => { key1: "foo" ... } (object) Expected: Lang.get("") => "" (string)

I know there is code that checks if the first argument to Lang.get() is the key name for one of the translation files and returns that object, but I am not sure if this is the intended behaviour.

Simple fix/PR would probably just be a if (key === '') { return '' }. Can provide if bug is confirmed.

carestad avatar Jan 30 '19 12:01 carestad