Skip to content

[HOLD for payment 2023-09-20] [$500] MacOS: Context Menu does not translate to Spanish #25704

Closed

Description

@izarutskaya

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. Launch Expensify MacOS app
  2. Set Profile > Preferences > Language > Spanish > Close
  3. In Report Composer, right click

Expected Result:

ContextMenu options are translated to Spanish like MenuItems in ToolBar

Actual Result:

ContextMenu options are not translated to Spanish

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: v1.3.55-7

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

context.translation.issue.mp4
2023-08-19.23.11.17.mp4

Expensify/Expensify Issue URL:

Issue reported by: @ygshbht

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01780b67747fbfff83
  • Upwork Job ID: 1696262248411463680
  • Last Price Increase: 2023-09-05

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 22, 2023
  2. melvin-bot commented on Aug 22, 2023

    @melvin-bot

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

  3. melvin-bot commented on Aug 22, 2023

    @melvin-bot

    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
  4. izarutskaya commented on Aug 22, 2023

    @izarutskaya
    Author

    Proposal from @ygshbht

    Proposal

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

    The issue is that on the Expensify MacOS app, the ContextMenu options are not being translated to Spanish, even when the user has set the language preference to Spanish.

    What is the root cause of that problem?

    The current setup for the ContextMenu in the application does not handle translations. Specifically, the labels for various options in the ContextMenu (like cut, paste, and copy) aren't being translated based on the user's language preference.

    App/desktop/main.js

    Lines 42 to 57 in 21146e5

    contextMenu({
    append: (defaultActions, parameters, browserWindow) => [
    new MenuItem({
    // Only enable the menu item for Editable context which supports paste
    visible: parameters.isEditable && parameters.editFlags.canPaste,
    role: 'pasteAndMatchStyle',
    accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AND_MATCH_STYLE,
    }),
    new MenuItem({
    label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'),
    visible: parameters.isEditable && parameters.editFlags.canPaste && clipboard.readText().length > 0,
    accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AS_PLAIN_TEXT,
    click: () => pasteAsPlainText(browserWindow),
    }),
    ],
    });

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

    To address this issue, the ContextMenu function can be enhanced to support translations. Specifically, the labels for the default menu options can be provided directly using the labels option, like so:

    labels: {
        cut: Localize.translate(preferredLocale, 'desktopApplicationMenu.cut'),
        paste: Localize.translate(preferredLocale, 'desktopApplicationMenu.paste'),
        copy: Localize.translate(preferredLocale, 'desktopApplicationMenu.copy'),
        /** Rest of the desired translations */
    }
    

    Additionally, for custom menu items that we're manually appending, the label can be set directly within the MenuItem:

    append: (defaultActions, parameters, browserWindow) => [
            new MenuItem({
                // Only enable the menu item for Editable context which supports paste
                visible: parameters.isEditable && parameters.editFlags.canPaste,
                role: 'pasteAndMatchStyle',
                accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AND_MATCH_STYLE,
                label: Localize.translate(preferredLocale, 'desktopApplicationMenu.pasteAndMatchStyle'),
            }),
            new MenuItem({
                label: Localize.translate(preferredLocale, 'desktopApplicationMenu.pasteAsPlainText'),
                visible: parameters.isEditable && parameters.editFlags.canPaste && clipboard.readText().length > 0,
                accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AS_PLAIN_TEXT,
                click: () => pasteAsPlainText(browserWindow),
            }),
        ],
    

    Please note this is the bulk of solution, minor modifications such as listening to language change events and recreating the menu also need to be done to ensure the app functions like in the video below

  5. ygshbht commented on Aug 22, 2023

    @ygshbht
    Contributor

    Thanks!

    Solution video:

    context.translation.solution.mp4
  6. melvin-bot commented on Aug 28, 2023

    @melvin-bot

    @michaelhaxhiu Eep! 4 days overdue now. Issues have feelings too...

  7. michaelhaxhiu commented on Aug 28, 2023

    @michaelhaxhiu
    Contributor

    EDITED: I had to brew on this one. I think it's a valid issue to fix, but it's small and non-urgent. For that reason I want to propose we dock the payments to be as follows for this one-off:

    Bug reporting bonus: $250
    Contributor fix: $500
    C+ proposal/PR review: $500

    I'm stating these now before I assign the External label so that folks know the prices before they invest too much time.

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 28, 2023
  9. changed the title [-]MacOS: Context Menu does not translate to Spanish[/-] [+][$1000] MacOS: Context Menu does not translate to Spanish[/+] on Aug 28, 2023
  10. melvin-bot commented on Aug 28, 2023

    @melvin-bot
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Aug 28, 2023
  12. 44 remaining items

  13. neil-marcellini commented on Sep 22, 2023

    @neil-marcellini
    Contributor

    Bump for payment @michaelhaxhiu

  14. michaelhaxhiu commented on Sep 22, 2023

    @michaelhaxhiu
    Contributor

    Payment summary:

    @situchan do you get paid via NewDot or Upwork?

  15. ygshbht commented on Sep 22, 2023

    @ygshbht
    Contributor

    Does this not get 50% bonus?

  16. michaelhaxhiu commented on Sep 22, 2023

    @michaelhaxhiu
    Contributor

    I am basing my price point on Vit's slack comment in #expensify-open-source here:

    https://expensify.slack.com/archives/C01GTK53T8Q/p1693407966629239?thread_ts=1693347701.566439&cid=C01GTK53T8Q

    Good question, i think to make this fair consider that if the PR is non-urgent ie non related to the above topics, you dont have to rush as it would most likely not be merged in the time for the urgency bonus. I believe if it’s urgent pr we make external the engineer/ bugzero person will clealy clarify that

    This was assigned Sept 5, and merged sept 11 (delay likely due to feature freeze). This scenario exact scenario is what Vit outlined in his commentimo. But at the same time... I get that there was some mixed guidance on this GH issue about bonuses and so this is totally fair for you to ask @ygshbht.

    If you & situ or @neil-marcellini feel strongly, I am obviously open to offering the bonus. I just was trying to fairly apply the rule in slack across the board. As you can imagine this gets hairy for a BZ to discern when we start making one-off exceptions from the rule of thumb.

  17. situchan commented on Sep 22, 2023

    @situchan
    Contributor

    @situchan do you get paid via NewDot or Upwork?

    upwork

    Example of bonus applied: #25889 (comment)

  18. neil-marcellini commented on Sep 25, 2023

    @neil-marcellini
    Contributor

    I approved the proposal on September 6th, the PR was raised the same day, C+ approved on the 8th, I approved and merged on the 12th. So it was good to merge within 3 days, but I was slow to review. I think we should give the bonuses @michaelhaxhiu.

  19. michaelhaxhiu commented on Sep 25, 2023

    @michaelhaxhiu
    Contributor

    Cool thanks for input @neil-marcellini (and sorry if i was a lil strict on my initial take, yall 😓)

  20. michaelhaxhiu commented on Sep 25, 2023

    @michaelhaxhiu
    Contributor

    Bug reporter: $250 @ygshbht
    Contributor: $750 @ygshbht (50% bonus)
    C+: @situchan $750 @situchan (50% bonus)

  21. michaelhaxhiu commented on Sep 25, 2023

    @michaelhaxhiu
    Contributor

    All are paid. @situchan can you please complete the BZ checklist so that we can close this?

  22. situchan commented on Sep 25, 2023

    @situchan
    Contributor

    No regression. This is for desktop only, Spanish only, context menu only which is super rare care for the user. I think this is enough reason why we don't wanna add regression test step.

  23. michaelhaxhiu commented on Sep 25, 2023

    @michaelhaxhiu
    Contributor

    Cool, I agree that this was just a candid oversight. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions