-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of n()
and $n()
with undefined
should not throw errors
#1746
Comments
Thank you for your feedback! The first argument of However, vue-i18n API documentation does not mention that an error is raised if an unexpected value is specified. I think it would help to mention it in the documentation. |
Hey, thanks for your answer! It would be great if it doesnt throw an error because values can always be undefined especially when working with inputs. And because this function just returns a string it would be nice if it returns an empty string in case of undefined input imo. Currently it breaks the full page/application just because one undefined value. |
Can we please allow
|
Also #1155 These strict runtime checks are incredibly inconvenient, I don't understand why you need to throw an error (often breaking the entire page) when just passing through null values and casting numbers to strings automatically would at worst display some mildly confusing strings to users and at best cause no problems because we have null checks after $t(). |
Clear and concise description of the problem
Sometimes values are undefined within an application, unfortunately this will throw a 500 error (at least in Nuxt) so the whole page is unavailable just because one variable is undefined:
Another example are inputs:
These can get undefined while the user is editing the input value which will also throw errors:
Suggested solution
It would be great if the function
n()
and$n()
would instead just return an empty string''
without the whole page crashing or throwing any errors.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: