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
Consider more forgiving DX #1735
Comments
In regards to ICU Message syntax what would you expect That said I did a little research and found that per the ECMAScript specs that the value is anything as it will be coerced to a number (defaulting with undefined). I didn't look up the other formats. But it seems to me that it is safe to assume |
I did a little more research:
Since format-message uses the above internal implementations their expectations should be the same (i.e. do not assert). Also since lists are the only one I found that does need an assertion and that the ICU message syntax does not provide for lists it is reasonable that the format-message also should not assert values. I am uncertain about the utility of allowing dynamic messages for format-message in app code instead perhaps using some alternative pattern that guarantees the existence of the value passed in (like hard coded strings or constants). As for format-list the ICU guides recommend its use outside the message formatting:
Which I interpret that we should to the following with lists: {{t "…" items=(format-list items)}} |
Environment
Steps to Reproduce
Because of the two points above I'd like to propose
ember-intl
not being overly aggressive on missing (undefined) values. Any code example below will blow up the entire application with the message attached:Since
this.nonexistent
is a variable that could come from many various sources (usually API) I as a developer have no control of it always being filled. Thus I will need to putif / else
block around every single call of these helpers.Now I'm not saying the developers should not do that to catch error states, but that's not how real world works and people will have code without those safeguards. And then a component that formats a date (or similar) just blows up entire application. And I think that should never happen.
Thoughts?
The text was updated successfully, but these errors were encountered: