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

[PAID] [$1000] The error is displayed in Spanish on invalid number chat even when the language preference has changed to English #18203

Closed
1 of 6 tasks
kavimuru opened this issue Apr 30, 2023 · 66 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kavimuru
Copy link

kavimuru commented Apr 30, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open android
  2. Go offline
  3. Change language to Spanish
  4. Click on new chat with invalid number , example 122455
  5. Send messages
  6. Now go back and change the language to english
  7. Go to the same chat again and turn your wifi on
  8. Notice that the error below the messages is shown in Spanish even when the language was already changed to English in offline mode. Except for the error message, every other sentence are shown in English.

Expected Result:

The error message should be shown in English when the language was changed in the preference

Actual Result:

The error is displayed in Spanish on invalid number chat even when the language preference has changed to English

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.8.8
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

error.mp4
az_recorder_20230429_234232.1.mp4

Expensify/Expensify Issue URL:
Issue reported by: @priya-zha
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1682764542821759

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e6c0bedde567e47c
  • Upwork Job ID: 1653077149487792128
  • Last Price Increase: 2023-05-08
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 30, 2023
@MelvinBot
Copy link

Triggered auto assignment to @kevinksullivan (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@MelvinBot
Copy link

MelvinBot commented Apr 30, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label May 1, 2023
@melvin-bot melvin-bot bot changed the title The error is displayed in Spanish on invalid number chat even when the language preference has changed to English [$1000] The error is displayed in Spanish on invalid number chat even when the language preference has changed to English May 1, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~01e6c0bedde567e47c

@MelvinBot
Copy link

Current assignee @kevinksullivan is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 1, 2023
@MelvinBot
Copy link

Triggered auto assignment to @chiragsalian (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@StevenKKC
Copy link
Contributor

StevenKKC commented May 1, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

The error is displayed in Spanish on invalid number chat even when the language preference has changed to English

What is the root cause of that problem?

The user's comment is saved by onSubmitComment.

onSubmitComment(text) {
Report.addComment(getReportID(this.props.route), text);
}

And addComment function calls addActions.

function addComment(reportID, text) {
addActions(reportID, text);
}

In addActions function, if an error occurs, the failure message is generated by Localize.translateLocal('report.genericAddCommentFailureMessage'), and is saved to Onyx. That is, the error will be saved in Spanish.

const failureData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: _.mapObject(optimisticReportActions, action => ({...action, errors: {[DateUtils.getMicroseconds()]: Localize.translateLocal('report.genericAddCommentFailureMessage')}})),
},
];

So if send the message fails, the translated Spanish error message is saved.

And the translated message is displayed by <Text key={i} style={styles.offlineFeedback.text}>{message}</Text>.

<View style={styles.offlineFeedback.textContainer}>
{_.map(sortedMessages, (message, i) => (
<Text key={i} style={styles.offlineFeedback.text}>{message}</Text>
))}
</View>

So even though the language preference has changed to English, the error will be displayed in Spanish.

What changes do you think we should make in order to solve the problem?

If the error occurs, instead of saving the translated error message, it would just save the error key directly to Onyx. (ex. report.genericAddCommentFailureMessage).

const failureData = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: _.mapObject(optimisticReportActions, action => ({...action, errors: {[DateUtils.getMicroseconds()]: 'report.genericAddCommentFailureMessage'}})),
},
];

When showing the error message, we first check the error key exists in the user's translation dictionary.

For this we would create a utility function inside Localize.

This utility function checks whether the error key exists in the translation dictionary of the user.
If the error key exists in the translation dictionary, then return the corresponding translated error message.
Otherwise return the error key itself. (In this case, the error key is the error message created and translated by the previous version.)

function translateError(phrase) {
const desiredLanguage = BaseLocaleListener.getPreferredLocale();

const defaultLanguageDictionary = lodashGet(translations, desiredLanguage, {});
const translatedPhrase = lodashGet(defaultLanguageDictionary, phrase);
if (translatedPhrase) {
return Str.result(translatedPhrase, {});
}

return phrase;
}

Now we can use this utility function to show the error message.
<Text key={i} style={styles.offlineFeedback.text}>{Localize.translateError(message)}</Text>

We can use this approach to cover all cases where we save the translation error to Onyx.

What alternative solutions did you explore? (Optional)

None.

@MelvinBot
Copy link

📣 @StevenKKC! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@StevenKKC
Copy link
Contributor

Contributor details
Your Expensify account email: steven.kkc.820@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0128670d4717009718

@MelvinBot
Copy link

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@fedirjh
Copy link
Contributor

fedirjh commented May 2, 2023

@StevenKKC Thank you for the proposal. I believe the root cause analysis is correct, this looks like a regression from #14736. However, I am unclear about the main solution you provided. Could you please elaborate on it further?

As for the optional solution, it seems more promising, but it could still use some improvement. One suggestion would be to save the error key report.genericAddCommentFailureMessage and then use a conditional render.

<Text key={i} style={styles.offlineFeedback.text}>
    {message === 'report.genericAddCommentFailureMessage'
        ? Localize.translateLocal('report.genericAddCommentFailureMessage')
        : message}
</Text>

@chiragsalian and @iwiznia I am wondering if genericAddCommentFailureMessage should be treated as a backend error and only displayed in English. There seem to be inconsistencies in the current setup, as seen below: when the language is set to Spanish, the backend error is displayed in English while the genericAddCommentFailureMessage is displayed in Spanish, which looks inconsistent.

Screenshot 2023-05-02 at 6 24 35 PM


Overall, I think we have two options:

  1. Display genericAddCommentFailureMessage in English.
  2. Store the genericAddCommentFailureMessage key instead and add a conditional rendering as explained above.

@StevenKKC
Copy link
Contributor

@fedirjh Thank you for your review. I haven't thought about it much. I'll pay more attention in the future. I appreciate your advice.

@StevenKKC
Copy link
Contributor

StevenKKC commented May 2, 2023

@fedirjh I think now that the language preference is set to Spanish, the backend error should be displayed in Spanish also.

@fedirjh
Copy link
Contributor

fedirjh commented May 2, 2023

I think now that the language preference is set to Spanish, the backend error should be displayed in Spanish also.

In fact, backend errors are not translated and are only displayed in English.

@StevenKKC
Copy link
Contributor

What can I do for this now? @fedirjh

@iwiznia
Copy link
Contributor

iwiznia commented May 3, 2023

@chiragsalian and @iwiznia I am wondering if genericAddCommentFailureMessage should be treated as a backend error and only displayed in English. There seem to be inconsistencies in the current setup, as seen below: when the language is set to Spanish, the backend error is displayed in English while the genericAddCommentFailureMessage is displayed in Spanish, which looks inconsistent.

We know it is inconsistent, but spanish is a beta feature for that reason. The goal is to have the app be localized and for that, we need to have that message in spanish too.

@fedirjh
Copy link
Contributor

fedirjh commented May 3, 2023

The goal is to have the app be localized and for that, we need to have that message in spanish too.

@iwiznia Thank you for the input. Do we have any other generic errors that we should consider in addition to this issue? If genericAddCommentFailureMessage is the only case, then using the key instead of the translation will be a good fit for that. We can store the genericAddCommentFailureMessage key and add conditional rendering as explained above. If there are other cases, then we should look for other proposals.

@iwiznia
Copy link
Contributor

iwiznia commented May 4, 2023

Sorry, I don't get the question. What is there to consider? Any message generated in the App needs to be translated.

@fedirjh
Copy link
Contributor

fedirjh commented May 4, 2023

Sorry, I don't get the question. What is there to consider ?

@iwiznia I mean to ask whether we should consider other cases in which translated error messages are saved optimistically in Onyx, not just this particular one.

@iwiznia
Copy link
Contributor

iwiznia commented May 4, 2023

Oh, no idea, I assume there are indeed more cases like that one.

@fedirjh
Copy link
Contributor

fedirjh commented May 4, 2023

Let me make a thorough check of the codebase to determine whether additional instances exist.

@fedirjh
Copy link
Contributor

fedirjh commented May 4, 2023

After a thorough investigation, I have discovered at least 17 additional instances where translated errors are being saved to Onyx. In order to fix this issue comprehensively, we must explore a more robust solution that can address all such occurrences.

Screenshot 2023-05-04 at 10 01 03 PM

@strepanier03
Copy link
Contributor

Thanks @chiragsalian, have a great weekend!

@StevenKKC
Copy link
Contributor

@chiragsalian @fedirjh @strepanier03 PR(#19324) is ready for review.
And when switch the language, an error is occurred. An error is not related to this PR, as described in PR. I think should open an issue.

@strepanier03
Copy link
Contributor

PR is up and reviews are happening, moving forward well here.

@strepanier03
Copy link
Contributor

PR is merged and awaiting push to staging and then prod. In a good holding spot on this one for now.

@fedirjh
Copy link
Contributor

fedirjh commented May 26, 2023

PR was merged to Production, however the automation wasn’t not triggered, I think the title should be updated manually.

@StevenKKC
Copy link
Contributor

@chiragsalian @fedirjh When does the title update? Because of the regression test mentioned in the issue (#19565), have not updated the title yet?

@StevenKKC
Copy link
Contributor

@chiragsalian
PR was merged and deployed to production in version 1.3.18-2.
But it has been 3 days ago and the title hasn't been updated yet.
I hope anyone would let me know the reason. Or is there anything I am missing?

@fedirjh
Copy link
Contributor

fedirjh commented May 30, 2023

@StevenKKC it's not related to regression test, the automation fails sometimes when we don't follow the right format in the PR template, the bot fails to find linked issue , hence the automation fails triggers.

@StevenKKC
Copy link
Contributor

@fedirjh Thanks for you reply.

@strepanier03 strepanier03 changed the title [$1000] The error is displayed in Spanish on invalid number chat even when the language preference has changed to English [HOLD for payment 2023-06-02] [$1000] The error is displayed in Spanish on invalid number chat even when the language preference has changed to English May 30, 2023
@strepanier03
Copy link
Contributor

strepanier03 commented May 30, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.18-2 🚀 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

#19324
If no regressions arise, payment will be issued on 2023-06-02. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter - @priya-zha - $250
  • Contributor that fixed the issue - @StevenKKC - $1000 + $500 (speed bonus) = $1500
  • Contributor+ that helped on the issue and/or PR - @fedirjh - $1000 + $500 (speed bonus) = $1500

Speed bonus analysis: Contributor hired on May 18 / PR merged on May 23 = 3 business days = Eligible

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

Merged PR within 3 business days of assignment - 50% bonus
Merged PR more than 9 business days after assignment - 50% penalty

@strepanier03
Copy link
Contributor

strepanier03 commented May 30, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • - [@fedirjh] - The PR that introduced the bug has been identified. Link to the PR:
  • - [@fedirjh] - The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • - [@fedirjh] - A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • - [@fedirjh] - Determine if we should create a regression test for this bug.
  • - [@fedirjh] - If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • - @strepanier03] - Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/288623

@strepanier03
Copy link
Contributor

@fedirjh and @StevenKKC - I did what should have happened manually and will prep for the hold being removed.

@strepanier03 strepanier03 added Weekly KSv2 and removed Daily KSv2 labels May 30, 2023
@strepanier03
Copy link
Contributor

The job originally created for this GH has been closed by Upwork so I had to make a new one.


@fedirjh - I have hired you for the job. Please feel free to complete the checklist items and I'll update it and make the reg test GH if needed.

@StevenKKC - I am not confident that I'm hiring the right "Steven" in Upwork. Can you apply for the job here and link me to your Upwork profile so I know for sure?

@priya-zha - I created a reporting job for you in Upwork, can you please apply here. I am not 100% confident that the Priya I'm finding in Upwork is you and would also appreciate a link to your Upwork profile so I am sure.


Thank you all, the hold is released tomorrow and I'll take what action I can then.

@strepanier03 strepanier03 added Daily KSv2 and removed Weekly KSv2 labels Jun 1, 2023
@fedirjh
Copy link
Contributor

fedirjh commented Jun 1, 2023

❌ - Link to the PR : This is a new feature
❌ - Link to comment
❌ - Link to discussion
🟢 - Determine if we should create a regression test for this bug.


Regression Test Proposal

  1. Open the App
  2. Go to offline mode
  3. Change language to Spanish
  4. Click on new chat with invalid number , e.g. 122455
  5. Send messages
  6. Now go back and change the language to english
  7. Go to the same chat again and turn your wifi on
  8. Verify that the error below the messages is shown in English.
  9. Change language to Spanish
  10. Go to the same chat again
  11. Verify that the error below the messages is shown in Spanish.

Do we agree 👍 or 👎

@StevenKKC
Copy link
Contributor

@strepanier03
I have applied for the job here, and my Upwork profile here.
Thank you.

@priya-zha
Copy link

@strepanier03 Submitted the proposal. Here's my upwork profile : https://www.upwork.com/freelancers/~011e32317dbbd489e0

Thanks

@melvin-bot
Copy link

melvin-bot bot commented Jun 4, 2023

📣 @kristianbarth! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@kristianbarth
Copy link

Contributor details
Your Expensify account email: kristianbarth212@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~017d74bef5648e0eec

@melvin-bot
Copy link

melvin-bot bot commented Jun 4, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@kristianbarth
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.18-2 🚀 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

#19324
If no regressions arise, payment will be issued on 2023-06-02. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

External issue reporter - @priya-zha - $250
Contributor that fixed the issue - @StevenKKC - $1000 + $500 (speed bonus) = $1500
Contributor+ that helped on the issue and/or PR - @fedirjh - $1000 + $500 (speed bonus) = $1500
Speed bonus analysis: Contributor hired on May 18 / PR merged on May 23 = 3 business days = Eligible

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

Merged PR within 3 business days of assignment - 50% bonus
Merged PR more than 9 business days after assignment - 50% penalty

@strepanier03
Copy link
Contributor

I finished up payment and the reg test GH is done. Thanks all!

@strepanier03 strepanier03 changed the title [HOLD for payment 2023-06-02] [$1000] The error is displayed in Spanish on invalid number chat even when the language preference has changed to English [PAID] [$1000] The error is displayed in Spanish on invalid number chat even when the language preference has changed to English Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests