-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Interpolation formatting does not support default format(s) #1384
Comments
And why should I expect any formatting happening with this: i18next.t("Total {{amount}} since {{date}}", {
amount: 123456.789,
date: new Date()
}) This says use the raw value (toString if needed) i18next.t("Total {{amount, number}} since {{date, dateShort}}", {
amount: 123456.789,
date: new Date()
}) says to format it and can be changed by translators as needed. |
I guess my question is why are we using the raw value and/or toString when a custom formatter exists? I feel like my toLocaleString example above is a reasonable enough use-case. |
You do not like to call functions if not needed to call them...just out of performance reason... |
Can merge your PR - but really do not agree in the behaviour is / should be default anytime in future |
The
format
argument of the formatter function is optional but must be supplied during interpolation in order for any custom formatting to take effect.Consider the following example
I don't see any reason why the interpolated values should not be formatted, yet that is the case. We can force formatting by supplying an empty format (include the separator but no value), but this is unintuitive, easily missed, and only discoverable by inspecting the source.
The text was updated successfully, but these errors were encountered: