kolibri
kolibri copied to clipboard
Perseus strings with a context and placeholders are text, not functions, in 0.20
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: release-v0.20.x
Observed behavior
wrapPerseusMessages(perseusTranslator).srLinearGraphPointsis a string. Perseus 78.2.0 calls it asstrings.srLinearGraphPoints({ point1X, point1Y, point2X, point2Y }).- The same holds for all 74
PerseusInternalMessagesentries that have both acontextand a placeholder, such assrPointAtCoordinates,srCircleShape,srPolygonSideLengthandmolecularDrawing. _getTranslatedStringOrFunctiontests/{/against the default message. For a{ message, context }entry that is an object, so the test never matches.- Placeholder messages without a
context, such ashintPos, resolve to functions.
Expected behavior
Each of those 74 entries resolves to a function of its arguments, as on develop since 0b4ae602a0.
User-facing consequences
Perseus 78.2.0 calls strings.srLinearGraphPoints(…) in describeLinearGraph while it renders a linear interactive graph. Calling a string throws a TypeError, which Perseus shows as its "Rendering Error!" icon in place of the widget, as in #16054.
Steps to reproduce
- Check out
release-v0.20.xat e3b074b70f. - In a Jest spec under
kolibri/plugins/perseus_viewer/frontend/__tests__/, importwrapPerseusMessagesfrom../translationUtilsandperseusTranslatorfrom../translator. - Evaluate
typeof wrapPerseusMessages(perseusTranslator).srLinearGraphPoints. It is'string'; forhintPosit is'function'.
Context
- Kolibri
release-v0.20.xat e3b074b70f @khanacademy/perseus78.2.0
Acceptance Criteria
- [ ] On
release-v0.20.x, everyPerseusInternalMessagesmessage with a placeholder resolves to a function throughwrapPerseusMessages, with or without acontext. - [ ] A Jest test calls a placeholder message that has a
contextwith its arguments and gets the formatted text.
AI usage
Claude Code found this while planning #16054 and drafted the issue.