Skip to content

Stop splitting up phrases for formatting #62808

Closed
17 of 17 issues completed
Closed

Description

@roryabraham

Design doc section: #62805

One thing we do in some locations in our existing translations is split phrases up into multiple keys (for example addPaymentCardReadAndAcceptTextPart1 and addPaymentCardReadAndAcceptTextPart2). Typically this is done because there’s different formatting used for different parts of the string - maybe one part is bold and another is not, or there’s a link between two parts, etc…

We’ll reclassify this as a bad practice, because ChatGPT will be able to perform better translations if it has context for the full phrase. Furthermore, some languages may have different sentence structure, resulting in the string needing to be divided up differently (this hasn’t happened yet with English and Spanish as far as I know, but some other languages are more different in their sentence structure than those two).

So we’ll clean all these up, and instead of manually splitting up these strings, we’ll just use HTML to style them richly (i.e: using <strong> for bold, <em> for italic, etc…) and then render that rich text with react-native-render-html (just like every chat message in NewDot).

We can use react-native-render-html to render whatever we want amidst text components. In the case of italic <strong> or links <a>, we already have renderers set up and ready to go. If we want to render complex/custom components, we already have a mechanism for that too - we can create a custom HTML-like tag and define a renderer for it. Some examples of us doing that can be found here.

Problem

When a phrase is split up into multiple chunks in English, and each of those chunks are translated separately, we get lower-quality translations than if the whole phrase is translated together.

Solution

  1. Identify all uses of "split phrase" translations in src/languages/en.ts, refactor those usages to use react-native-render-html instead
  2. Document that splitting phrases in translations is a bad practice, with good and bad examples
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021927053003546041104
  • Upwork Job ID: 1927053003546041104
  • Last Price Increase: 2025-05-26
  • Automatic offers:
    • allgandalf | Reviewer | 107456556
    • PiyushChandra17 | Contributor | 107456557
Issue OwnerCurrent Issue Owner: @roryabraham

Sub-issues

Sub-issues

17 of 17 Issues completed
Loading 17 sub-issues

Activity

  1. self-assigned this
    on May 26, 2025
  2. added
    External
    Daily
    NewFeature
    on May 26, 2025
  3. changed the title [-]Stop splitting up phrases for formatting[/-] [+][$250] Stop splitting up phrases for formatting[/+] on May 26, 2025
  4. melvin-bot commented on May 26, 2025

    @melvin-bot
  5. added
    Help Wanted
    on May 26, 2025
  6. melvin-bot commented on May 26, 2025

    @melvin-bot

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

  7. melvin-bot commented on May 26, 2025

    @melvin-bot

    Triggered auto assignment to @miljakljajic (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details. Please add this Feature request to a GH project, as outlined in the SO.

  8. added
    Weekly
    and removed
    Daily
    on May 26, 2025
  9. melvin-bot commented on May 26, 2025

    @melvin-bot

    ⚠️ It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time ⚠️

  10. 391 remaining items

  11. roryabraham commented on Oct 28, 2025

    @roryabraham
    ContributorAuthor

    The sub-issues are moving

  12. roryabraham commented on Dec 4, 2025

    @roryabraham
    ContributorAuthor

    Just submitted a review for #75129

  13. roryabraham commented on Dec 9, 2025

    @roryabraham
    ContributorAuthor

    Just merged one of the last PRs here. I think there may only be one left now

  14. roryabraham commented on Dec 19, 2025

    @roryabraham
    ContributorAuthor

    This is done

  15. ikevin127 commented on Nov 27, 2026

    @ikevin127
    Contributor

    Small regression from #68260 here. When the upgrade success message moved into a single HTML string, the workspace name went in unencoded, so HTML in the name rendered on the upgrade confirmation page. It's fixed now, and payment for the fix is tracked in #107982.

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

Metadata

Metadata

Labels

ExternalNewFeatureWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions