Skip to content

[HOLD for payment 2021-09-22] iOS - Chat- Menu options after selecting add attachment is not translated to Spanish #5103

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
kavimuru opened this issue Sep 6, 2021 · 27 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Sep 6, 2021

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


Action Performed:

  1. Log in with a applause.expensifail account
  2. Navigate to Settings > Preferences
  3. Set the language to Spanish
  4. Tap on any chat
  5. Tap on + sign > Add Attachment

Expected Result:

The app language changed to Spanish by navigating to several areas in the app

Actual Result:

After changing the language to Spanish - the menu options displayed in English

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • iOS

Version Number:
1.0.94-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

Bug5222374_3.09-3.mp4

Expensify/Expensify Issue URL:

View all open jobs on GitHub

@MelvinBot
Copy link

Triggered auto assignment to @sketchydroide (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@PrashantMangukiya
Copy link
Contributor

PrashantMangukiya commented Sep 7, 2021

Proposed Solution

Here is the problem: We are preparing menu item data at component load (within constructor), but whenever language changed we are not taking care for language change. i.e. we need to refresh menu item data within src/components/AttachmentPicker/index.native.js whenever language changed.

Below is current code for constructor:

constructor(...args) {
super(...args);
this.state = {
isVisible: false,
};
this.menuItemData = [
{
icon: Camera,
text: this.props.translate('attachmentPicker.takePhoto'),
pickAttachment: () => this.showImagePicker(launchCamera),
},
{
icon: Gallery,
text: this.props.translate('attachmentPicker.chooseFromGallery'),
pickAttachment: () => this.showImagePicker(launchImageLibrary),
},
{
icon: Paperclip,
text: this.props.translate('attachmentPicker.chooseDocument'),
pickAttachment: () => this.showDocumentPicker(),
},
];
this.close = this.close.bind(this);
this.pickAttachment = this.pickAttachment.bind(this);
}

Solution: We have to update code as below. i.e. Need to prepare menu item data at component load and when language changed i.e. within componentDidUpdate() we can compare preferredLocale value, so if language changed then refresh menu item data.

I will prefer to go this way because we need a new translation whenever language changed, So better to update menu item translation whenever we detect language changed i.e. via componentDidUpdate(). So it will not call this.props.translate() method during every render. It will help to improve performance at some level.

    constructor(...args) {
        super(...args);

        this.state = {
            isVisible: false,
        };

        this.menuItemData = this.getMenuItemData();   // ** code moved to getMenuItemData()

        this.close = this.close.bind(this);
        this.pickAttachment = this.pickAttachment.bind(this);
        this.getMenuItemData = this.getMenuItemData.bind(this);    // ** Added bind for getMenuItemData()
    }

    // Refresh menu item data if language changed (*** Added  this lifecycle method)
    componentDidUpdate(prevProps) {
        if (this.props.preferredLocale !== prevProps.preferredLocale) {
            this.menuItemData = this.getMenuItemData();
        }
    }

    /**
      * Get menu item data
      *
      *  @returns {Array}
      */
    getMenuItemData() {
        return [
            {
                icon: Camera,
                text: this.props.translate('attachmentPicker.takePhoto'),
                pickAttachment: () => this.showImagePicker(launchCamera),
            },
            {
                icon: Gallery,
                text: this.props.translate('attachmentPicker.chooseFromGallery'),
                pickAttachment: () => this.showImagePicker(launchImageLibrary),
            },
            {
                icon: Paperclip,
                text: this.props.translate('attachmentPicker.chooseDocument'),
                pickAttachment: () => this.showDocumentPicker(),
            },
        ];
    }

Screen recording based on my solution, It shows perfect behaviour now.

iOS.Screen.Recording.mov

If this issue consider as external, and my solution accepted then kindly invite me on Upwork.
My Upwork profile: https://www.upwork.com/freelancers/~01c718889ed7821f82

Thank you.

@sketchydroide
Copy link
Contributor

I cannot replicate this on my iPhone, the same version running (1.0.94-0).

@PrashantMangukiya
Copy link
Contributor

I tested v1.0.94-0 on iOS Simulator. I can re-produce this issue. Below is screen recording.

Screen.Recording.2021-09-07.at.5.09.49.PM.mov

@sketchydroide sketchydroide added the External Added to denote the issue can be worked on by a contributor label Sep 7, 2021
@MelvinBot MelvinBot added Weekly KSv2 and removed Daily KSv2 labels Sep 7, 2021
@MelvinBot
Copy link

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

@MelvinBot MelvinBot added Daily KSv2 and removed Weekly KSv2 labels Sep 7, 2021
@sketchydroide
Copy link
Contributor

I added the external, I can't replicate, please @marklouisdeshaun try to replicate if possible.
I also asked in engineering-chat for more people to try to replicate, at the moment no one did yet https://expensify.slack.com/archives/C03TQ48KC/p1631013560315700

@marklouisdeshaun
Copy link
Contributor

I also cannot replicate this. When I tried on my iPhone Xs with iOS 14.7.1, running v1.0.93-1, the Spanish translations were there.

@sketchydroide
Copy link
Contributor

I will try to replicate this on the simulator, but we should try to get a couple more people from expensify try to replicate this

@PrashantMangukiya
Copy link
Contributor

PrashantMangukiya commented Sep 7, 2021

Hi Guys, I just installed v1.0.93-1 from app store. I can reproduce issue within my iPhoneXsMax iOS 14.6

Below is screen recording from real device. I reduced quality to 480p because GH allow max 10MB file.

iPhoneXsMax-iOS14-6.mov

@sketchydroide
Copy link
Contributor

I can also not replicate it with the appstore version. 1.0.93-1.
There is clearly something wrong as QA and Prashant can see it happen, I'm just unsure on what the solution is, the proposed solution seems reasonable, but the discrepance of some people not being to replicate it worries me a bit. Also I would like to find someone that can replicate it, so we can test the fix.

@PrashantMangukiya
Copy link
Contributor

I also installed app store v1.0.93-1 to my family member's iPhone. I can reproduce it within iPhone6Plus iOS 12.5.4 Just sharing it so it will helpful to QA and Engineering team.

Below is screen recording from iPhone6Plus (iOS 12.5.4)

iPhone6Plus-iOS12.5.4-480.mov

@sketchydroide
Copy link
Contributor

@Jag96 was able to replicate this so I'm CCing into this, also I'm OOO in 2 days so can't really follow this, so I'm unassigning myself.
@marklouisdeshaun please go ahead and create the job :)

@sketchydroide sketchydroide removed their assignment Sep 9, 2021
@parasharrajat
Copy link
Member

Text on menu items does not update as we are only translating the text in the constructor.

Proposal

  1. A minimal solution for this would be use translation keys in the menu items array and then translate it in the Render method.

Here text would be changed to textTranslationKey

    
    text: this.props.translate('attachmentPicker.takePhoto') ===>   textTranslationKey: 'attachmentPicker.takePhoto'

then in the render method.

<MenuItem
key={item.text}
icon={item.icon}
title={item.text}
onPress={() => this.selectItem(item)}

                                 <MenuItem
                                     key={item.textTranslationKey}
                                     icon={item.icon}
                                     title={this.props.translate(item.textTranslationKey)}
                                     onPress={() => this.selectItem(item)}
                                 />

This pattern is already followed by the app and it is minimal.

@marklouisdeshaun
Copy link
Contributor

@MelvinBot MelvinBot added Weekly KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors and removed Daily KSv2 labels Sep 9, 2021
@MelvinBot
Copy link

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

@PrashantMangukiya
Copy link
Contributor

Hi @marklouisdeshaun Submitted proposal on upwork. Also here is my proposed solution: #5103 (comment) I will be happy to prepare for pr if my solution accepted. Thanks.

@sketchydroide
Copy link
Contributor

Hey @PrashantMangukiya and @parasharrajat, I think @parasharrajat makes more sense as it is simpler and cleaner, and I think falls more into what we want New.Expensify code to look like.
So we are going with your solution @parasharrajat.

@PrashantMangukiya thanks for the testing you did, and for proposing a solution :)

@MelvinBot MelvinBot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 10, 2021
@marklouisdeshaun
Copy link
Contributor

Hired @parasharrajat in Upwork.

@isagoico
Copy link

Issue reproducible during KI retests.

@botify
Copy link

botify commented Sep 13, 2021

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@botify
Copy link

botify commented Sep 13, 2021

🚀 Deployed to staging by @johnmlee101 in version: 1.0.97-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@botify botify added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 15, 2021
@botify botify changed the title iOS - Chat- Menu options after selecting add attachment is not translated to Spanish [HOLD for payment 2021-09-22] iOS - Chat- Menu options after selecting add attachment is not translated to Spanish Sep 15, 2021
@botify
Copy link

botify commented Sep 15, 2021

🚀 Deployed to production by @francoisl in version: 1.0.98-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@isagoico
Copy link

Issue not reproducible during KI retests.

@botify botify added Weekly KSv2 and removed Weekly KSv2 labels Sep 20, 2021
@botify botify changed the title [HOLD for payment 2021-09-22] iOS - Chat- Menu options after selecting add attachment is not translated to Spanish [HOLD for payment 2021-09-27] [HOLD for payment 2021-09-22] iOS - Chat- Menu options after selecting add attachment is not translated to Spanish Sep 20, 2021
@botify
Copy link

botify commented Sep 20, 2021

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

If no regressions arise, payment will be issued on 2021-09-27. 🎊

@mountiny mountiny changed the title [HOLD for payment 2021-09-27] [HOLD for payment 2021-09-22] iOS - Chat- Menu options after selecting add attachment is not translated to Spanish [HOLD for payment 2021-09-22] iOS - Chat- Menu options after selecting add attachment is not translated to Spanish Sep 20, 2021
@mountiny
Copy link
Contributor

mountiny commented Sep 20, 2021

This message is a bug, caused by today's deploy and some weird GH API behaviour. Updated the title back to what it was 🙇

@parasharrajat
Copy link
Member

Ping for
image

@marklouisdeshaun
Copy link
Contributor

The contributor has been paid, the contract has been completed and the job has been closed in Upwork. Thanks @parasharrajat !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

10 participants