Skip to content

[Due for payment 2025-12-25] [$250] Distance rate changes are not translated in non-English in admin room #75842

Closed

Description

@jponikarchuk

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


Version Number: v9.2.62-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #75518
Email or phone of affected tester (no customers): gocemate+b2155581@gmail.com
Issue reported by: Applause Internal Team
Device used: Lenovo 80ES / Windows 10 Pro
App Component: Chat Report View

Action Performed:

  1. Create a new workspace
  2. Enable Distance rates
  3. Add a Rate> Disable/enable, rename, delete the rate
  4. Change the language to any Non-English
  5. Open the admin room thread

Expected Result:

Distance rate actions should be translated in the thread and thread header

Actual Result:

Distance rate actions are not translated in the thread

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021995492043595795673
  • Upwork Job ID: 1995492043595795673
  • Last Price Increase: 2025-12-01
Issue OwnerCurrent Issue Owner: @dylanexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 24, 2025
  2. melvin-bot commented on Nov 24, 2025

    @melvin-bot

    Triggered auto assignment to @dylanexpensify (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.

  3. nkdengineer commented on Nov 24, 2025

    @nkdengineer
    Contributor

    Proposal

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

    Distance rate actions are not translated in the thread

    What is the root cause of that problem?

    1. The distance rate change action isn't translated because we don't handle the translation for the updatedField like index, enabled,

    if (customUnitName && customUnitRateName && updatedField === 'rate' && typeof oldValue === 'string' && typeof newValue === 'string') {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('workspaceActions.updatedCustomUnitRate', {
    customUnitName,
    customUnitRateName,
    updatedField,
    oldValue,
    newValue,
    });
    }
    if (customUnitRateName && updatedField === 'taxRateExternalID' && typeof newValue === 'string' && newTaxPercentage) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('workspaceActions.updatedCustomUnitTaxRateExternalID', {
    customUnitRateName,
    newValue,
    newTaxPercentage,
    oldTaxPercentage,
    oldValue: oldValue as string | undefined,
    });
    }
    if (customUnitRateName && updatedField === 'taxClaimablePercentage' && typeof newValue === 'number' && customUnitRateName) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('workspaceActions.updatedCustomUnitTaxClaimablePercentage', {
    customUnitRateName,
    newValue: parseFloat(parseFloat(newValue ?? 0).toFixed(2)),
    oldValue: typeof oldValue === 'number' ? parseFloat(parseFloat(oldValue ?? 0).toFixed(2)) : undefined,
    });
    }

    1. All distance rate change actions like add, update, and remove action are not translated in the thread header because we don't handle this in getReportName function

    function getReportName(

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

    1. Update the translation for others updatedField: index, enabled

    if (customUnitName && customUnitRateName && updatedField === 'rate' && typeof oldValue === 'string' && typeof newValue === 'string') {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('workspaceActions.updatedCustomUnitRate', {
    customUnitName,
    customUnitRateName,
    updatedField,
    oldValue,
    newValue,
    });
    }
    if (customUnitRateName && updatedField === 'taxRateExternalID' && typeof newValue === 'string' && newTaxPercentage) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('workspaceActions.updatedCustomUnitTaxRateExternalID', {
    customUnitRateName,
    newValue,
    newTaxPercentage,
    oldTaxPercentage,
    oldValue: oldValue as string | undefined,
    });
    }
    if (customUnitRateName && updatedField === 'taxClaimablePercentage' && typeof newValue === 'number' && customUnitRateName) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    return translateLocal('workspaceActions.updatedCustomUnitTaxClaimablePercentage', {
    customUnitRateName,
    newValue: parseFloat(parseFloat(newValue ?? 0).toFixed(2)),
    oldValue: typeof oldValue === 'number' ? parseFloat(parseFloat(oldValue ?? 0).toFixed(2)) : undefined,
    });
    }

    1. Update getReportName function to return the correct translation when the parent action is distance rate changes action
    if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE)) {
            return getWorkspaceCustomUnitRateAddedMessage(parentReportAction);
        }
        if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE)) {
            return getWorkspaceCustomUnitRateUpdatedMessage(parentReportAction);
        }
        if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE)) {
            return getWorkspaceCustomUnitRateDeletedMessage(parentReportAction);
        }
    

    function getReportName(

    Note: We can check other actions which have the same problem

    What alternative solutions did you explore? (Optional)

    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.

  4. abbasifaizan70 commented on Nov 24, 2025

    @abbasifaizan70
    Contributor

    Proposal

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

    When distance rate actions (enable/disable, rename, delete) are performed in a workspace, the action messages displayed in the admin room thread and thread header are not translated when the language is set to a non-English language. The messages appear in English regardless of the selected language.

    What is the root cause of that problem?

    The getWorkspaceCustomUnitRateUpdatedMessage function in ReportActionsUtils.ts only handles specific updatedField values:

    • 'rate' (for rate value changes)
    • 'taxRateExternalID' (for tax rate changes)
    • 'taxClaimablePercentage' (for tax claimable percentage changes)

    However, it does not handle:

    • 'enabled' (for enable/disable actions)
    • 'name' (for rename actions)

    When these fields are updated, the function falls back to getReportActionText(action), which returns hardcoded English text from the backend instead of using translation keys. This causes the messages to appear in English even when a non-English language is selected.

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

    Add handling for 'enabled' and 'name' fields in the getWorkspaceCustomUnitRateUpdatedMessage function, similar to how other fields are handled. We need to add translation keys for these actions and use them when these specific fields are updated.

    1. Add translation keys to en.ts (and other language files)

    Add new translation keys in the workspaceActions section:

    // In App/src/languages/en.ts around line 6220-6234
    updatedCustomUnitRateEnabled: ({customUnitName, customUnitRateName, enabled}: UpdatedPolicyCustomUnitRateEnabledParams) =>
        `${enabled ? 'enabled' : 'disabled'} the ${customUnitName} rate "${customUnitRateName}"`,
    updatedCustomUnitRateName: ({customUnitName, customUnitRateName, oldName, newName}: UpdatedPolicyCustomUnitRateNameParams) =>
        `renamed the ${customUnitName} rate "${oldName}" to "${newName}"`,

    2. Update getWorkspaceCustomUnitRateUpdatedMessage function

    Update the function in App/src/libs/ReportActionsUtils.ts to handle 'enabled' and 'name' fields:

    // Around line 2670-2706
    function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string {
        const {customUnitName, customUnitRateName, updatedField, oldValue, newValue, newTaxPercentage, oldTaxPercentage} =
            getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE>) ?? {};
    
        // ... existing code for 'rate', 'taxRateExternalID', 'taxClaimablePercentage' ...
    
        // Add handling for 'enabled' field
        if (customUnitName && customUnitRateName && updatedField === 'enabled' && typeof newValue === 'boolean') {
            // eslint-disable-next-line @typescript-eslint/no-deprecated
            return translateLocal('workspaceActions.updatedCustomUnitRateEnabled', {
                customUnitName,
                customUnitRateName,
                enabled: newValue,
            });
        }
    
        // Add handling for 'name' field
        if (customUnitName && customUnitRateName && updatedField === 'name' && typeof oldValue === 'string' && typeof newValue === 'string') {
            // eslint-disable-next-line @typescript-eslint/no-deprecated
            return translateLocal('workspaceActions.updatedCustomUnitRateName', {
                customUnitName,
                customUnitRateName: oldValue, // Use old name as the rate name
                oldName: oldValue,
                newName: newValue,
            });
        }
    
        return getReportActionText(action);
    }

    3. Add TypeScript type definitions

    Add parameter types for the new translation keys (similar to existing types like UpdatedPolicyCustomUnitRateParams):

    // In the types file where other workspace action params are defined
    type UpdatedPolicyCustomUnitRateEnabledParams = {
        customUnitName: string;
        customUnitRateName: string;
        enabled: boolean;
    };
    
    type UpdatedPolicyCustomUnitRateNameParams = {
        customUnitName: string;
        customUnitRateName: string;
        oldName: string;
        newName: string;
    };

    What alternative solutions did you explore? (Optional)

    An alternative would be to modify the backend to send translated messages, but this approach is less flexible and would require backend changes. The current approach of handling translations on the frontend is consistent with how other workspace actions are handled (e.g., tax updates, category updates) and provides better maintainability and consistency.

  5. melvin-bot commented on Nov 28, 2025

    @melvin-bot

    @dylanexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 1, 2025
  7. changed the title [-]Distance rate changes are not translated in non-English in admin room[/-] [+][$250] Distance rate changes are not translated in non-English in admin room[/+] on Dec 1, 2025
  8. melvin-bot commented on Dec 1, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 1, 2025
  10. melvin-bot commented on Dec 1, 2025

    @melvin-bot

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

  11. 16 remaining items

  12. melvin-bot commented on Dec 18, 2025

    @melvin-bot

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

  13. melvin-bot commented on Dec 18, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.81-5 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 2025-12-25. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on Dec 18, 2025

    @melvin-bot

    @abdulrahuman5196 @dylanexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  15. melvin-bot commented on Dec 25, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@dylanexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1995492043595795673/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. abdulrahuman5196 commented on Dec 29, 2025

    @abdulrahuman5196
    Contributor

    BugZero Checklist:

    • [Contributor] 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: Not regression. Implementation miss.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    1. Create a new workspace
    2. Enable Distance rates
    3. Add a Rate> Disable/enable, rename, delete the rate
    4. Change the language to any Non-English
    5. Open the admin room thread
    6. Verify that the Distance rate actions is translated in the thread and thread header

    Do we agree 👍 or 👎

    @dylanexpensify

  17. melvin-bot commented on Dec 31, 2025

    @melvin-bot

    @dylanexpensify Still overdue 6 days?! Let's take care of this!

  18. melvin-bot commented on Jan 2, 2026

    @melvin-bot

    @dylanexpensify Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

  19. dylanexpensify commented on Jan 5, 2026

    @dylanexpensify
    Contributor

    Payment summary:

    Contributor+: @abdulrahuman5196 $250 via NewDot
    Contributor+: @nkdengineer $250 via NewDot

    Please apply/request!

  20. twisterdotcom commented on Jan 12, 2026

    @twisterdotcom
    Contributor

    @nkdengineer has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-c69f-a0f3-23b1-c4715ec38cf4
  21. trjExpensify commented on Jan 21, 2026

    @trjExpensify
    Contributor

    approved $250 for @abdulrahuman5196

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