-
Notifications
You must be signed in to change notification settings - Fork 350
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
Bugfix: error messages aren't displayed as translated strings #2160
Conversation
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (98435b3) and published it to npm. You Example: yarn add @khanacademy/perseus@PR2160 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR2160 |
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.
Looks ok to me, thank you!
Size Change: -3.57 kB (-0.24%) Total Size: 1.48 MB
ℹ️ View Unchanged
|
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.
Yay for future proofing!
Summary:
Proposing a bug fix for error messages not showing up as translated: https://khanacademy.slack.com/archives/C06FULVQLSV/p1738014199191129?thread_ts=1738012970.693379&cid=C06FULVQLSV
What I thought we were doing: Originally I thought
strings
were getting replaced during the translation process (I don't know why I thought that). So we were mapping error codes to error strings directly off ofstrings
.What we were actually doing:
strings
isn't actually changed, it's used to make a new object that has all of the translated strings in it. So we were pulling the English strings off of the base object that was used to create a separate translated object.What this PR does: instead of pulling from
strings
, we instead pass the translated strings intomapErrorToString
. Then we map an error code to a key that we use to access the translated message from the passed in object.Test plan: