Skip to content

[Due for payment 2026-10-23] [$175] Make the GPS distance counter label a fully localized phrase #103488

Closed

Description

@MelvinBot

Problem

The GPS distance counter builds its label by joining separate pieces in JSX instead of using one translated phrase:

  • the common.distance field name
  • the rounded distance number, styled bold
  • a hard-coded space, then the raw unit value (mi / km), styled muted

See DistanceCounter.tsx:36-40.

This breaks in locales where:

  • there is no space between the amount and the unit
  • the unit comes before the amount
  • the amount and unit come before the "Distance" label

The unit is also shown as the raw value and is never translated.

Proposed fix

Replace the joined pieces with one full phrase in src/languages/en.ts and every other language file. Mark up its parts (amount, unit, label) so RenderHTML can style them, like the bold amount and muted unit shown today. Each locale then controls word order and spacing.

Context

Raised as a non-blocking follow-up in this review comment on MenuItem decomposition - description text style.

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. chuckdries commented on Oct 8, 2026

    @chuckdries
    Contributor

    I can take this one

  2. chuckdries commented on Oct 8, 2026

    @chuckdries
    Contributor

    Generally, we're going to want to use Intl.NumberFormat here.

    // plumb locale and unit as appropriate
    const formatter = new Intl.NumberFormat('en-US', {
      style: 'unit',
      unit: 'kilometer',
      unitDisplay: 'short'
    });
    
    const parts = formatter.formatToParts(distance);

    parts should be an array something like

    [
      { "type": "integer", "value": "1" },
      { "type": "group", "value": "," },
      { "type": "integer", "value": "540" },
      { "type": "decimal", "value": "." },
      { "type": "fraction", "value": "5" },
      { "type": "literal", "value": " " },
      { "type": "unit", "value": "km" }
    ]

    Assuming I'm reading the existing code correctly, to match the current styling behavior, we want to render them in the order that they're returned, wrapping just the type === 'unit' part with styles.colorMuted.

    Feel free to extend libs/NumberFormatUtils as appropriate

  3. added
    ImprovementItem broken or needs improvement.
    ExternalAdded to denote the issue can be worked on by a contributor
    and removed on Oct 8, 2026
  4. melvin-bot commented on Oct 8, 2026

    @melvin-bot

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

  5. changed the title [-]Make the GPS distance counter label a fully localized phrase[/-] [+][$175] Make the GPS distance counter label a fully localized phrase[/+] on Oct 8, 2026
  6. melvin-bot commented on Oct 8, 2026

    @melvin-bot
  7. yuvrajangadsingh commented on Oct 8, 2026

    @yuvrajangadsingh
    Contributor

    withdrawing this, it went up before the issue had the Help Wanted label. will come back if the label is added.

  8. 22 remaining items

  9. melvin-bot commented on Oct 16, 2026

    @melvin-bot

    @ahmedGaber93

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.12-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 2026-10-23. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  10. melvin-bot commented on Oct 16, 2026

    @melvin-bot

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

  11. melvin-bot commented on Oct 20, 2026

    @melvin-bot

    @ahmedGaber93 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  12. melvin-bot commented on Oct 22, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. melvin-bot commented on Oct 22, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  14. ahmedGaber93 commented on Oct 23, 2026

    @ahmedGaber93
    Contributor

    Contributor+ Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: N/A. This a refactoring issue
      Link to the comment on the Issue: N/A. This a refactoring issue

    • [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: N/A

    • [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.

    This is a straightforward change, so I don’t think we need a regression test here.

  15. mallenexpensify commented on Oct 26, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @ahmedGaber93 due $175 via NewDot

  16. flaviadefaria commented on Nov 9, 2026

    @flaviadefaria
    Contributor

    Approved: @ahmedGaber93 due $175 via NewDot

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 productionDailyKSv2ExternalAdded to denote the issue can be worked on by a contributorImprovementItem broken or needs improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions