Skip to content
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

Conditionally switch decimal separator based on locale #800

Merged
merged 2 commits into from
Nov 15, 2023

Conversation

handeyeco
Copy link
Contributor

@handeyeco handeyeco commented Nov 14, 2023

Summary:

We were supposed to be switching between , and ., but we didn't see that through when updating how we're rendering icons for the v2 keypad. This updates that and adds some unit tests.

Screenshot 2023-11-14 at 10 21 29 AM Screenshot 2023-11-14 at 10 20 55 AM

Issue: LC-1453

Test plan:

  • Use or simulate mobile web
  • Go to an exercise with a MathInput
  • Open the keypad by focusing the MathInput
  • Note a . as the decimal separator (if you're in the US)
  • Change your locale?
  • Use or simulate mobile web
  • Go to an exercise with a MathInput
  • Open the keypad by focusing the MathInput
  • Note a , as the decimal separator

@handeyeco handeyeco self-assigned this Nov 14, 2023
@khan-actions-bot khan-actions-bot requested a review from a team November 14, 2023 17:32
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Nov 14, 2023

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/spotty-snails-serve.md, packages/math-input/src/enums.ts, packages/math-input/src/utils.ts, packages/math-input/src/data/key-configs.ts, packages/math-input/src/components/key-handlers/key-translator.ts, packages/math-input/src/components/keypad/button-assets.tsx, packages/math-input/src/components/keypad/__tests__/keypad.test.tsx, packages/math-input/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap, packages/math-input/src/components/keypad/__tests__/__snapshots__/mobile-keypad.test.tsx.snap

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

Copy link
Contributor

github-actions bot commented Nov 14, 2023

Size Change: +234 B (0%)

Total Size: 863 kB

Filename Size Change
packages/math-input/dist/es/index.js 108 kB +234 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.1 kB
packages/kmath/dist/es/index.js 4.25 kB
packages/perseus-core/dist/es/index.js 907 B
packages/perseus-editor/dist/es/index.js 269 kB
packages/perseus-error/dist/es/index.js 878 B
packages/perseus-linter/dist/es/index.js 21.8 kB
packages/perseus/dist/es/index.js 404 kB
packages/pure-markdown/dist/es/index.js 3.77 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

@handeyeco handeyeco changed the title conditionally switch decimal separator based on locale Conditionally switch decimal separator based on locale Nov 14, 2023
@handeyeco handeyeco requested a review from a team November 14, 2023 17:47
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #800 (0f6e97c) into main (6078ac0) will increase coverage by 1.26%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #800      +/-   ##
==========================================
+ Coverage   60.67%   61.93%   +1.26%     
==========================================
  Files         484      486       +2     
  Lines      105880   105903      +23     
  Branches     6224     8919    +2695     
==========================================
+ Hits        64243    65596    +1353     
+ Misses      41637    40307    -1330     

Impacted file tree graph

Files Coverage Δ
...nput/src/components/key-handlers/key-translator.ts 92.79% <100.00%> (-0.10%) ⬇️
...math-input/src/components/keypad/button-assets.tsx 62.18% <100.00%> (+0.48%) ⬆️
packages/math-input/src/data/key-configs.ts 100.00% <100.00%> (+0.75%) ⬆️
packages/math-input/src/enums.ts 100.00% <ø> (ø)
packages/math-input/src/utils.ts 94.11% <100.00%> (+1.26%) ⬆️

... and 31 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6078ac0...0f6e97c. Read the comment docs.

Copy link
Contributor

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (0f6e97c) and published it to npm. You
can install it using the tag PR800.

Example:

yarn add @khanacademy/perseus@PR800

Copy link
Contributor

@nedredmond nedredmond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the actual localization is handled in Webapp? I don't see here where we are conditionally switching based on locale.

@handeyeco
Copy link
Contributor Author

I guess the actual localization is handled in Webapp? I don't see here where we are conditionally switching based on locale.

It's based off of wonder-blocks-i18n. The logic already existed from the v1 keypad days, we just needed to tweak some things to make it work with the v2 keypad.

// utils.ts
import {getDecimalSeparator} from "@khanacademy/wonder-blocks-i18n";

@handeyeco handeyeco merged commit 1d58b88 into main Nov 15, 2023
12 checks passed
@handeyeco handeyeco deleted the LC-1453/decimal-separator branch November 15, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants