-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Localize decimal separator #9800
Localize decimal separator #9800
Conversation
@eVoloshchak Can you include desktop recording too & also please check all the checkboxes in the author checklist. |
@eVoloshchak Check your web video from 00 to 06 secs. I see value getting lost temporarily. You are entering 233.32, it appears 33.32 for fraction of seconds. |
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.
sorry I aproved while only seeing the code, but @Santhosh-Sellavel is right the web video looks off
I think that my screen recorder is recording at low fps, what i see on the screen and on the video are not the same thing. I updated the web section with a screen capture shot on a phone camera video_2022-07-13_14-33-58.mp4 |
I can't run in on desktop unfortunately, due to #8888 it won't run using recent node versions, and i can't install older node since I use macInCloud |
Please update the screen record so that's a more reliable option, to ensure everything. I believe you can do that on macincloud also. |
Sure! This is a screen recording from Windows machine, it seems to have more fps. 1.New.Expensify.-.Google.Chrome.2022-07-14.15-44-32.mp4 |
@eVoloshchak can you repeat the same steps in staging and share the recording. With that, we can rule out whether the behavior is caused by this PR or not thanks!
|
Of course New.Expensify.-.Google.Chrome.2022-07-16.18-17-54.mp4 |
PR Reviewer Checklist
|
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 good and tests well @sketchydroide.
@eVoloshchak great job getting your first Expensify/App pull request over the finish line! I'll merge it assuming all the tests pass. I know there's a lot of information in our contributing guidelines, so some points to take note of: Once your PR is merged, you can be hired for another issue. Once you've completed a few issues, we may start hiring you for more than one issue at a time. Once your PR is deployed to our staging servers, it will undergo quality assurance (QA) testing. If we find that this doesn't work as expected or causes a regression, you'll be responsible for fixing it. Typically we would revert this PR and give you another chance to create a similar PR without causing a regression. (I don't imagine this will happen with this PR, but it's something to be aware of) Once your PR is deployed to production, we start a 7-day timer. After it has been on production for 7 days without causing any regressions, then we pay out the Upwork job. So it might take a while before you're paid for your work, but we typically post multiple new jobs every day, so there's plenty of opportunity. I hope you've had a positive experience contributing to this repo! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Not my first Expensify/App pull request, but still thanks 😄 |
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 was checking some other PR and saw these changes to IOUAmountPage which I feel like very off from the planned design of this page.
I tested the IOUAmountPage before this PR and it was accepting ,
instead of .
for Spanish locale.
Why do we have to change IOUAmountPage here? First of all, How is this related to this issue?
@@ -63,7 +63,7 @@ class BigNumberPad extends React.Component { | |||
style={[styles.flex1, marginLeft]} | |||
text={column === '<' ? column : this.props.toLocaleDigit(column)} | |||
onLongPress={() => this.handleLongPress(column)} | |||
onPress={() => this.props.numberPressed(column)} | |||
onPress={() => this.props.numberPressed(column === '<' ? column : this.props.toLocaleDigit(column))} |
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.
How is this change related to this PR? cc: @Santhosh-Sellavel
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.
How is this change related to this PR? cc: @Santhosh-Sellavel
Previously BigNumberPad
was displaying ,
while still passing .
to this.props.numberPressed
on Spanish, now it's passing the sybmol that is displayed on the key
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.
That is how it is supposed to work Internally the values will always be in English for eg.
22,23
is really 22.23
which will be saved to the backend. So it was working correctly.
Manipulating this value here is not a good approach. These changes break the whole concept.
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.
We are not saving it as 22,23
or 22.33
. We are rounding it off after multiplying by a hundred, so it's saved as 2233
. I'm not sure about what we broke here?
cc: @sketchydroide
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.
by the backend, I mean internally not DB. Why do we have to change this piece of code? It does not look related to the issue. Can anyone please help me understand this?
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.
Why do we have to change this piece of code? It does not look related to the issue. Can anyone please help me understand this?
This keyboard is used only on IOUAmountPage
, so it seemed logical to make it return the displayed symbol.
Alternatively we can move this logic to IOUAmountPage
, change this line to
const amount = `${prevState.amount}${this.props.toLocaleDigit(key)}`;
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.
Do we really need this change? Commit before the merge commit shows the correct behavior of showing ,
on UI and Allowing the user to type ,
for Spanish and .
for English.
This keyboard is used only on IOUAmountPage, so it seemed logical to make it return the displayed symbol.
How?
- Keyboard should show
,
for spanish. - Textinput or amount input should show
,
for spanish.
Both of these were already happening so why is change needed?
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.
Do you think there was any bug on IOUAmountPage that you solved here? What was that? Issue talks about the problem with the rate field on the reimbursement form. Can we fix the rate field issue without touching IOUAmountPage?
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.
Do you think there was any bug on IOUAmountPage that you solved here? What was that? Issue talks about the problem with the rate field on the reimbursement form.
But the screenshot in the issue description features Request money
screen. I've asked about this a couple of times, there must have been a miscommunication
OK, i think i got confused, since the issue description is talking about the Rate input on Reimburce Expenses screen, while screenshot contains IOU Amount Page with an amount input
I'm still not sure which one of the two screens needs to be fixed
Can we fix the rate field issue without touching IOUAmountPage?
Yes we can
I've checked new.expensify.com and it does indeed support comma for Spanish language on Request Money screen.
I'm guessing we need o revert this PR and clarify what the requirements for this issue are, it it's just for the rate field
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.
It seems yes issue details are incorrect. Unfortunately, it was not captured during the proposal review. As a suggestion, please try to get a full consensus before you start if you feel something is off. You can also suggest corrections to the requirements.
Thanks for understanding. I will open this discussion on the issue so that this PR can be reverted and you can start new.
} | ||
|
||
setRate(value) { | ||
const isInvalidRateValue = value !== '' && !CONST.REGEX.RATE_VALUE.test(value); | ||
const decimalSeparator = this.props.fromLocaleDigit('.'); |
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.
use of fromLocaleDigit
is wrong here as per your changes. Why?
fromLocaleDigit accepts a localized char, .
is not decimal in spanish so it should this.props.fromLocaleDigit(',');
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.
use of
fromLocaleDigit
is wrong here as per your changes. Why?
Thanks, that is a good catch. They return the same value when passing .
and I missed it and used the wrong function on IOUAmountPage
, while using the right one on BigNumberPad
. I'll open a PR with fix for this after the discussion around the BigNumberPad
.
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.
.
is the grouping separator in Spanish, i.e ,
in English.
Easy to miss, thanks @parasharrajat!
Need to update this @eVoloshchak!
cc: @sketchydroide
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.
Need to update this @eVoloshchak!
I can fix this in #10028, would that be ok?
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.
@sketchydroide are we okay with it?
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.
Please hold on to it. We are first trying to decide why are these changes needed at all.
🚀 Deployed to staging by @sketchydroide in version: 1.1.86-0 🚀
|
🚀 Deployed to production by @yuwenmemon in version: 1.1.86-5 🚀
|
@eVoloshchak and @parasharrajat the linked issue has been incorrectly linked:
|
Santhosh-Sellavel was C+ here. But thanks for the note. |
Sorry Rajat, saw you amongst the reviewers. @Santhosh-Sellavel for the note above 🙇 |
🤦 Oops @mountiny Thanks for the note! |
Heads up @parasharrajat @Santhosh-Sellavel @sketchydroide! Just FYI: this PR caused a bug here: #11352 |
I already asked to revert it #9800 (comment) because I didn't agree with the changes. we had a revert PR #10129. There must be follow up PR. cc: @Santhosh-Sellavel as C+. |
@puneetlath This PR was reverted not sure how it caused a regression! |
Good point fellas. My bad lol. Will look further into it! |
Details
This change allows user to use comma (
,
) instead of a dot (.
) as a decimal separator onWorkspaceReimburseView
andIOUAmountPage
when using Spanish language.Fixed Issues
$ #9497
Tests
FAB > Request money
.
button at the bottom left corner of the onscreen keyboardSettings > Workspace > Reimburse expenses
Rate
inputFAB > Request money
,
button at the bottom left corner of the onscreen keyboardSettings > Workspace > Reimburse expenses
Rate
inputPR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followed/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
FAB > Request money
.
button at the bottom left corner of the onscreen keyboardSettings > Workspace > Reimburse expenses
Rate
inputFAB > Request money
,
button at the bottom left corner of the onscreen keyboardSettings > Workspace > Reimburse expenses
Rate
inputScreenshots
Web
video_2022-07-13_14-33-58.mp4
cinnamon-20220707-5.mp4
Mobile Web
22-07-07-23-08-01.mp4
iOS
cinnamon-20220708-9.MP4
Android
22-07-08-12-13-35.mp4