Skip to content

Merge account - Error messages in code section are not translated to Spanish #59784

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

Closed
6 of 8 tasks
jponikarchuk opened this issue Apr 8, 2025 · 10 comments · Fixed by #59911
Closed
6 of 8 tasks

Merge account - Error messages in code section are not translated to Spanish #59784

jponikarchuk opened this issue Apr 8, 2025 · 10 comments · Fixed by #59911
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Reviewing Has a PR in review Weekly KSv2

Comments

@jponikarchuk
Copy link

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.1.24-2
Reproducible in staging?: Yes
Reproducible in production?: Unable to check, new feature
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: -
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Macbook Pro 2023 / Sequoia 15.2
App Component: User Settings

Action Performed:

Precond: App is in Spanish

  1. Go to staging.new.expensify.com
  2. Go to Settings > Security.
  3. Tap Merge account.
  4. Enter email of another account.
  5. Mark "I understand this is not reversible" checkbox.
  6. Click Next.
  7. Enter incorrect magic code

OR In Step 4, enter an email address that does not exist to receive an error message

OR in Step 4, enter the same email address to receive an error message

Expected Result:

User expects the error message to be translated to spanish like the rest of the app

Actual Result:

The error message is not in Spanish

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Image Image Image

View all open jobs on GitHub

@jponikarchuk jponikarchuk added Bug Something is broken. Auto assigns a BugZero manager. DeployBlockerCash This issue or pull request should block deployment labels Apr 8, 2025
Copy link

melvin-bot bot commented Apr 8, 2025

Triggered auto assignment to @JmillsExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Copy link

melvin-bot bot commented Apr 8, 2025

Triggered auto assignment to @Gonals (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@melvin-bot melvin-bot bot added the Daily KSv2 label Apr 8, 2025
Copy link

melvin-bot bot commented Apr 8, 2025

💬 A slack conversation has been started in #expensify-open-source

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Apr 8, 2025
Copy link
Contributor

github-actions bot commented Apr 8, 2025

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@thelullabyy
Copy link
Contributor

thelullabyy commented Apr 8, 2025

Proposal

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

  • The error message is not in Spanish

What is the root cause of that problem?

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

  • We can create the logic to translate the error message returned from BE:
    const errorTextToDisplay = () => {
        if (latestError === '404 Cannot merge account into itself') {
            return translate('404 Cannot merge account into itself');
        }
        if (latestError === `404 Account doesn't exist`) {
            return translate(`404 Account doesn't exist`);
        }
        if (latestError === '401 Not authorized - Invalid validateCode') {
            return translate(`401 Not authorized - Invalid validateCode`);
        }
    };

and use it in:

validateError={!errorKey ? mergeWithValidateCode?.errors : undefined}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

  • NA

What alternative solutions did you explore? (Optional)

  • BE can return the translate key, then FE will use that translate key to render to correct error message to display based on the current preferred language.

@Gonals Gonals added Daily KSv2 and removed Hourly KSv2 DeployBlockerCash This issue or pull request should block deployment labels Apr 8, 2025
@Gonals
Copy link
Contributor

Gonals commented Apr 8, 2025

Let's not block on this

@Eskalifer1
Copy link
Contributor

Eskalifer1 commented Apr 8, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-04-08 10:36:02 UTC.

Proposal

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

Merge account - Error messages in code section are not translated to Spanish

What is the root cause of that problem?

We just render the error we get from the backend: validateError={!errorKey ? mergeWithValidateCode?.errors : undefined}

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

We need to add the errorFields parameter to the data for Onyx for value, and then give the error in failureData, just like we do on the verification page. You can add a new translation to have more control for both languages under the mergeAccountsPage.mergeInvalidMagicCode key.

Also change the clearMergeWithValidateCode, add here this line errorFields: null

After that, in the App/src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx file, we get the first error
const earliestError = getEarliestErrorField(account, “invalidMagicCode”) and display it:
validateError={!errorKey ? earliestError : undefined}

Image

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

None

What alternative solutions did you explore? (Optional)

I noticed that there is a problem with displaying a specific error from the backend. That is, we can have several variants of errors returned by the backend, but the same error is always displayed, which we have provided in failureData. The error could be determined dynamically (if possible) or we could provide keys in the form of an error string in the translation file, for example:
“401 Not Authorized - invalid validateCode": “Incorrect or invalid magic code. Please try again or request a new code.”, similarly for Spanish, but this approach would require writing a key on the front end for each error, and probably change the existing approach that we have at the moment. This is just my opinion on what improvements could be made

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Copy link
Contributor

github-actions bot commented Apr 8, 2025

⚠️ @Eskalifer1 Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

@arosiclair
Copy link
Contributor

Taking over on this one. It's part of #47073 (comment)

@allroundexperts
Copy link
Contributor

Working on it

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 9, 2025
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. Engineering Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants