-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Use string literals for transaction category localized messages #10391
Use string literals for transaction category localized messages #10391
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea
Builds ready [b0d0613]
Page Load Metrics (1375 ± 115 ms)
|
b0d0613
to
cc1dc19
Compare
return defaultTitle; | ||
} | ||
throw new Error( | ||
`Unrecognized transaction category: ${transactionCategory}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe weird that we dont hit this validation if the defaultTitle is present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the default case to imply that it was OK for the category to not be matched. That's how it's used in useTransactionDisplayData
for example - there was a fallback present.
But now that you mention it... that doesn't seem ideal, I agree. Maybe we can remove the need for that fallback case. I'll look into that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was addressed in a8ab8e8
The default case has been replaced by another condition in the one case it was relied upon.
Builds ready [cc1dc19]
Page Load Metrics (872 ± 20 ms)
|
We now use string literals for all transaction category localized messages. This makes it easier to verify that we have translations for each of them, and that we aren't leaving any unused translations around.
The default case of `getTransactionCategoryTitle` wasn't necessary. I audited all cases where the `transactionCategory` property is assigned, and they all assign it to known transaction categories. So it should be impossible for that to be an unrecognized value. The only real case the fallback was useful for was when `null` or `undefined` was given as the transaction category in the confirm transaction base component. That case was handled there instead.
de1aa5c
to
a8ab8e8
Compare
Builds ready [a8ab8e8]
Page Load Metrics (969 ± 55 ms)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
We now use string literals for all transaction category localized messages. This makes it easier to verify that we have translations for each of them, and that we aren't leaving any unused translations around.