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

[core] feat(NumericInput): support localization #4388

Merged
merged 20 commits into from
Nov 16, 2020

Conversation

hunterxyz
Copy link
Contributor

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

This pull request is proposing to implement the locale to the NumericInput component and changing the format according to it.

Example:

en-US : 1000.99
de-DE: 1000,99

Reviewers should focus on:

number formatting flow

Screenshot

NumericInput

@palantirtech
Copy link
Member

Thanks for your interest in palantir/blueprint, @hunterxyz! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@adidahiya adidahiya changed the title au/numeric input locale [core] feat(NumericInput): support localization Oct 26, 2020
Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

Mostly looks good, thanks for the PR @hunterxyz! I left some comments.

docs-app preview build

packages/core/src/components/forms/numericInputUtils.ts Outdated Show resolved Hide resolved
packages/core/src/components/forms/numericInputUtils.ts Outdated Show resolved Hide resolved
packages/core/src/components/forms/numericInputUtils.ts Outdated Show resolved Hide resolved
packages/core/src/components/forms/numericInput.tsx Outdated Show resolved Hide resolved
packages/core/src/components/forms/numericInput.tsx Outdated Show resolved Hide resolved
@adidahiya
Copy link
Contributor

Also this locales list is pretty long and unwieldy as shown here...

image

  1. do we need all of these? can we just demonstrate the feature with a few key interesting locales?
  2. can you please convert this to a <Select> dropdown? for example see the <IconSelect> component in docs-app: https://github.com/palantir/blueprint/blob/2a052c5e5f5a2a77aac259cb6651840291c0f0fe/packages/docs-app/src/examples/core-examples/common/iconSelect.tsx

@hunterxyz
Copy link
Contributor Author

Also this locales list is pretty long and unwieldy as shown here...

image

  1. do we need all of these? can we just demonstrate the feature with a few key interesting locales?
  2. can you please convert this to a <Select> dropdown? for example see the <IconSelect> component in docs-app: https://github.com/palantir/blueprint/blob/2a052c5e5f5a2a77aac259cb6651840291c0f0fe/packages/docs-app/src/examples/core-examples/common/iconSelect.tsx

Since I reduced the list to 7 entries, a complex select is no more justified I guess, let me know

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

looks pretty good! just some minor comments

packages/core/src/components/forms/numericInput.tsx Outdated Show resolved Hide resolved
@adidahiya
Copy link
Contributor

@adidahiya
Copy link
Contributor

@hunterxyz I will cut a release of Blueprint tonight, would be great to get this PR included

@hunterxyz
Copy link
Contributor Author

@adidahiya

@hunterxyz I will cut a release of Blueprint tonight, would be great to get this PR included

Oh my... I'm going to sleep in a bit, I'm in europe.

@adidahiya
Copy link
Contributor

@hunterxyz ah, ok then, no worries! no rush at all :)

@adidahiya
Copy link
Contributor

I pushed my suggested minor changes

@hunterxyz
Copy link
Contributor Author

ok :D

@adidahiya adidahiya merged commit eec68c0 into palantir:develop Nov 16, 2020
@jlismore
Copy link

It's probably an issue with the docs setup, but it's possible to cause the linked docs build to crash with Uncaught RangeError: invalid language tag: ""
Repro steps:

  1. Enter 0.5 in input
  2. Change locale to anything else
  3. Change locale back to Default
  4. Crash

@adidahiya
Copy link
Contributor

@jlismore thanks for reporting, I can repro that bug in the docs app but it sounds like an unlikely scenario in real world usage... nonetheless would you mind filing a new issue to track the bug?

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.

4 participants