Uniswap / Uniswap/interface

crowdin auto translations do not consider JSX substitutions as tokens

Open
#2,421 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug p1
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Bug Description
When you use the Trans macro and include JSX components, e.g.:

import {Trans} from '@lingui/macro';

function MyComponent() {
  return <Trans>Hello <UserName/></Trans>;
}

The source string gets extracted and uploaded to Crowdin correctly as

Hello <0/>

However, the auto translation by Google Translate that we have set up in Crowdin does not recognize JSX tags as substitutions, and will for certain languages mess with the <0/> tag, e.g. for Arabic:

image

As a result, the automatic translation uploads a bunch of broken translations to the repository

image

Expected Behavior

The JSX substitution tokens are not modified by Crowdin

Additional Context

Crowdin's translation service has the same problem

I don't think substitution tokens that use the format {0}, {1}, etc. are affected

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the Trans macro's JSX substitution tokens are extracted and uploaded to Crowdin, then inspect the Google Translate and Crowdin auto-translation path. Reproduce the Arabic case and verify that tags such as <0/> remain unchanged in the generated translations.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.