Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
2.95k stars 2.46k forks source link

[HOLD for payment 2023-06-23] [$1000] Room - Room name rename text is translated in chat but not translated to Spanish in LHN #20124

Closed kbecciv closed 10 months ago

kbecciv commented 10 months ago

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 the app
  2. Open any room or create new room
  3. Click on room name in header, change room name using: settings->room name
  4. Change language to Spanish and observe that room name text in chat is translated to Spanish but LHN text is not translated

Expected Result:

App should translate LHN text for room rename to Spanish as it does for text in chat

Actual Result:

App translates room rename text in chat but does not translate room rename text in LHN

Workaround:

Unknown

Platforms:

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

Version Number: 1.3.23.6

Reproducible in staging?: yes

Reproducible in production?: yes

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

https://github.com/Expensify/App/assets/93399543/91a88295-8fb2-4988-a4b2-2e67058fe04d

https://github.com/Expensify/App/assets/93399543/edbc23ea-d3fd-4372-8dd7-d9770b94866c

Expensify/Expensify Issue URL:

Issue reported by: @dhanashree-sawant

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685522100748299

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b9817b9e53ecc2b4
  • Upwork Job ID: 1665754369245933568
  • Last Price Increase: 2023-06-05
melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

Bug0 Triage Checklist (Main S/O)

c3024 commented 10 months ago

Proposal

Please restate the problem that we are trying to solve in this issue. When room name is changed, and language changed to Spanish, the text room name changed to new room name is not translated into Spanish.

What is the root cause of the problem?

https://github.com/Expensify/App/blob/0813e2ca1476635a8324cbd9f998424663a33128/src/components/LHNOptionsList/OptionRowLHN.js#LL202C44-L202C44

Here alternativeText is not translated.

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

Translate the phrase from backend and send. Or we can have an ES phrase for Room name changed to and append it to the new text of the room to get the translated phrase.

What other solutions did you explore?

None

Ollyws commented 10 months ago

Proposal

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

When the language is changed to Spanish, the text in the LHN is still in English.

What is the root cause of that problem?

We are using the last message in the LHN which comes from the backend and just says "Room renamed to..."

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

Instead of displaying the last message, we should simply use the existing translation key (newRoomPage.renamedRoomAction) that we use for displaying the renamedRoom message in the chat, this way the text in the LHN will match the text in the chat. This can be implemented in SidebarUtils by getting the required data from visibleReportActionItems and checking if the last reportAction was of the type RENAMED before assigning alternateText with the translation. Something like:

    const lastAction = visibleReportActionItems[report.reportID]
    if (lastAction) {
        const oldName = lodashGet(lastAction, 'originalMessage.oldName', '');
        const newName = lodashGet(lastAction, 'originalMessage.newName', '');
        const lastActorDisplayName = lodashGet(visibleReportActionItems[report.reportID], 'person[0].text');
        if (lastAction.actionName && lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.RENAMED) {
            result.alternateText = lastActorDisplayName + Localize.translate(preferredLocale, 'newRoomPage.renamedRoomAction', {oldName, newName})
        }
    }

What alternative solutions did you explore? (Optional)

None

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

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

abdulrahuman5196 commented 10 months ago

Not overdue melvin now only came external

aidear3 commented 10 months ago

Contributor details Your Expensify account email: javsfdev323@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01b7fc496875b2b3dd

melvin-bot[bot] commented 10 months ago

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

kamaljitSharma21 commented 10 months ago

Proposal

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

Room - Room name rename text is translated in chat but not translated to Spanish in LHN has context menu

What is the root cause of that problem?

The alternateText is coming directly from backend and we are displaying it as it is without translating.

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

We can create two variables inside es.js and en.js respectively.

Here In es.js

roomRenamedTo: 'Sala renombrada a '

and here in en.js

roomRenamedTo: 'Room renamed to ',

Instead of displaying the backend message directly, We can check the last action is equal to rename here then on the basis of that we can use the above localize variable to display the correct translated message.

Updated code :

const reportName = ReportUtils.getReportName(report);
const lastAction = visibleReportActionItems[report.reportID];

if (lastAction && lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.RENAMED) {
    result.alternateText = Localize.translate(preferredLocale, 'report.roomRenamedTo') + reportName;
}

Note: As we need reportName in our updated code that's why we moved this line to few line-up.

Here is the sample video of the solution :

https://github.com/Expensify/App/assets/98891986/94aea8e0-cb8a-47fb-a9d2-1a11a3a5b74c

What alternative solutions did you explore? (Optional)

NA

abdulrahuman5196 commented 10 months ago

I like @Ollyws proposal here - https://github.com/Expensify/App/issues/20124#issuecomment-1575153551 It similar to how we translate for archived rooms. Sameways we show the original message in the chat list by translating - https://github.com/Expensify/App/blob/main/src/components/ReportActionItem/RenameAction.js#L24

We should do the same for LHN as well.

One suggestion is, its fine to just show Room renamed to in english the same way as now and its translated string in spanish and not use the big string in the chat renamed this room from ${oldName} to ${newName} since LHN is a small space.

🎀👀🎀 C+ Reviewed

cc: @neil-marcellini

kamaljitSharma21 commented 10 months ago

I like @Ollyws proposal here - #20124 (comment) It similar to how we translate for archived rooms. Sameways we show the original message in the chat list by translating - https://github.com/Expensify/App/blob/main/src/components/ReportActionItem/RenameAction.js#L24

We should do the same for LHN as well.

One suggestion is, its fine to just show Room renamed to in english the same way as now and its translated string in spanish and not use the big string in the chat renamed this room from ${oldName} to ${newName} since LHN is a small space.

🎀👀🎀 C+ Reviewed

cc: @neil-marcellini

@abdulrahuman5196 the suggestion that you have given is covered in this #20124 (comment), like added translated strings in the respective language file and using the same to display the text in the selected language. can you please relook at this proposal?

abdulrahuman5196 commented 10 months ago

@kamaljitSharma21 Thank your for the proposal. I did check your proposal before approving here. It only a minor suggestion/variation which could have easily changed in PR.

neil-marcellini commented 10 months ago

I agree with @abdulrahuman5196's decision that @Ollyws' proposal https://github.com/Expensify/App/issues/20124#issuecomment-1575153551 looks best. I think it might need some small tweaks but we'll handle that in the PR.

melvin-bot[bot] commented 10 months ago

📣 @Ollyws You have been assigned to this job by @neil-marcellini! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Keep in mind: Code of Conduct | Contributing 📖

melvin-bot[bot] commented 10 months ago

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

On to the next one 🚀

Ollyws commented 10 months ago

Although as Melvin says, it took 4 days we did have it ready and approved within the three days. It would be great if this could be taken into consideration.

neil-marcellini commented 10 months ago

I approved and merged at the same time though 🤔. Anyways I did request some changes because I missed the fact that we were also fixing another issue here, so ultimately I slowed this down by a day.

I think we should give @Ollyws the bonus 😄

johncschuster commented 10 months ago

Thanks, @neil-marcellini! I'll make sure the bonus is included 👍

melvin-bot[bot] commented 10 months ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 10 months ago

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

If no regressions arise, payment will be issued on 2023-06-23. :confetti_ball:

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.

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

melvin-bot[bot] commented 10 months ago

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:

abdulrahuman5196 commented 10 months ago

BZ checklist:

The PR that introduced the bug has been identified. Link to the PR: 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: 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:

Not a regression. But the implementation was not done until now.

Determine if we should create a regression test for this bug. 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.

No. I don't think a regression test would be beneficial for this minor translation issue.

neil-marcellini commented 10 months ago

Not overdue, gentle bump @johncschuster

johncschuster commented 10 months ago

@dhanashree-sawant / @Ollyws / @abdulrahuman5196 can you please apply to the Upwork job, here? I'll get payment issued shortly!

abdulrahuman5196 commented 10 months ago

Thank you. Applied for the upwork job @johncschuster

Ollyws commented 10 months ago

@johncschuster Also applied. Thanks!

johncschuster commented 10 months ago

Great! I've extended offers to you both!

Ollyws commented 10 months ago

@johncschuster Accepted, thanks!

johncschuster commented 10 months ago

Payment has been issued to @Ollyws and @abdulrahuman5196 🎉

I still need to pay @dhanashree-sawant before closing the issue.

dhanashree-sawant commented 10 months ago

Hi @johncschuster, Thank you. Applied for the upwork job

johncschuster commented 10 months ago

All payments have been issued! 🎉