Commit 17e338a
authored
test: add unit tests for Turkish locale placeholder validation (#29951)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
Crowdin sometimes emits Turkish copy as %{{name}} next to ICU-style
{{…}}. In i18n-js, % + { starts a %{…} placeholder, so %{{…}} breaks
interpolation and users see missing-placeholder text.
Changes: locales/languages/tr.json — replace the old %%{placeholder}
pattern with {{placeholder}}% where values are plain numbers (aligned
with English). Keep perps.order.leverage_modal.liquidation_warning as
{{percentage}} only (no extra % in the string), because the app already
passes a value that includes %.
Tests: locales/tr.placeholders.test.js walks every string in tr.json and
fails if any value contains %{{ or %%{, so CI catches bad Crowdin
exports quickly.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.
Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [ ] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [ ] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: changes are limited to Turkish translation strings and a
Jest test that validates placeholder formatting, with no runtime logic
changes beyond string interpolation behavior.
>
> **Overview**
> Fixes Turkish `tr.json` percent placeholders by replacing
`%%{...}`/`%{{...}}`-style patterns with `{{...}}%` so interpolation
works correctly.
>
> Adds `locales/tr.placeholders.test.js`, which recursively scans all
leaf strings in `tr.json` and fails CI if any translation contains `%{{`
or `%%{` to catch bad Crowdin exports early.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1cb8b9c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent cdcabc7 commit 17e338a
2 files changed
Lines changed: 82 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1134 | 1134 | | |
1135 | 1135 | | |
1136 | 1136 | | |
1137 | | - | |
| 1137 | + | |
1138 | 1138 | | |
1139 | 1139 | | |
1140 | 1140 | | |
| |||
1386 | 1386 | | |
1387 | 1387 | | |
1388 | 1388 | | |
1389 | | - | |
| 1389 | + | |
1390 | 1390 | | |
1391 | 1391 | | |
1392 | 1392 | | |
| |||
1816 | 1816 | | |
1817 | 1817 | | |
1818 | 1818 | | |
1819 | | - | |
| 1819 | + | |
1820 | 1820 | | |
1821 | 1821 | | |
1822 | 1822 | | |
| |||
2515 | 2515 | | |
2516 | 2516 | | |
2517 | 2517 | | |
2518 | | - | |
| 2518 | + | |
2519 | 2519 | | |
2520 | 2520 | | |
2521 | 2521 | | |
| |||
5735 | 5735 | | |
5736 | 5736 | | |
5737 | 5737 | | |
5738 | | - | |
5739 | | - | |
| 5738 | + | |
| 5739 | + | |
5740 | 5740 | | |
5741 | 5741 | | |
5742 | 5742 | | |
| |||
6340 | 6340 | | |
6341 | 6341 | | |
6342 | 6342 | | |
6343 | | - | |
6344 | | - | |
| 6343 | + | |
| 6344 | + | |
6345 | 6345 | | |
6346 | 6346 | | |
6347 | 6347 | | |
6348 | 6348 | | |
6349 | | - | |
| 6349 | + | |
6350 | 6350 | | |
6351 | 6351 | | |
6352 | | - | |
| 6352 | + | |
6353 | 6353 | | |
6354 | 6354 | | |
6355 | 6355 | | |
6356 | 6356 | | |
6357 | 6357 | | |
6358 | 6358 | | |
6359 | 6359 | | |
6360 | | - | |
| 6360 | + | |
6361 | 6361 | | |
6362 | 6362 | | |
6363 | 6363 | | |
| |||
6448 | 6448 | | |
6449 | 6449 | | |
6450 | 6450 | | |
6451 | | - | |
| 6451 | + | |
6452 | 6452 | | |
6453 | 6453 | | |
6454 | 6454 | | |
6455 | 6455 | | |
6456 | 6456 | | |
6457 | 6457 | | |
6458 | | - | |
| 6458 | + | |
6459 | 6459 | | |
6460 | 6460 | | |
6461 | 6461 | | |
| |||
6471 | 6471 | | |
6472 | 6472 | | |
6473 | 6473 | | |
6474 | | - | |
6475 | | - | |
| 6474 | + | |
| 6475 | + | |
6476 | 6476 | | |
6477 | 6477 | | |
6478 | 6478 | | |
6479 | 6479 | | |
6480 | 6480 | | |
6481 | 6481 | | |
6482 | | - | |
6483 | | - | |
| 6482 | + | |
| 6483 | + | |
6484 | 6484 | | |
6485 | 6485 | | |
6486 | 6486 | | |
6487 | 6487 | | |
6488 | 6488 | | |
6489 | 6489 | | |
6490 | 6490 | | |
6491 | | - | |
6492 | | - | |
| 6491 | + | |
| 6492 | + | |
6493 | 6493 | | |
6494 | 6494 | | |
6495 | 6495 | | |
6496 | 6496 | | |
6497 | 6497 | | |
6498 | | - | |
6499 | | - | |
| 6498 | + | |
| 6499 | + | |
6500 | 6500 | | |
6501 | 6501 | | |
6502 | 6502 | | |
| |||
6519 | 6519 | | |
6520 | 6520 | | |
6521 | 6521 | | |
6522 | | - | |
| 6522 | + | |
6523 | 6523 | | |
6524 | 6524 | | |
6525 | 6525 | | |
| |||
6565 | 6565 | | |
6566 | 6566 | | |
6567 | 6567 | | |
6568 | | - | |
| 6568 | + | |
6569 | 6569 | | |
6570 | 6570 | | |
6571 | 6571 | | |
6572 | 6572 | | |
6573 | | - | |
| 6573 | + | |
6574 | 6574 | | |
6575 | 6575 | | |
6576 | 6576 | | |
| |||
6834 | 6834 | | |
6835 | 6835 | | |
6836 | 6836 | | |
6837 | | - | |
| 6837 | + | |
6838 | 6838 | | |
6839 | 6839 | | |
6840 | 6840 | | |
| |||
7202 | 7202 | | |
7203 | 7203 | | |
7204 | 7204 | | |
7205 | | - | |
| 7205 | + | |
7206 | 7206 | | |
7207 | 7207 | | |
7208 | 7208 | | |
| |||
7248 | 7248 | | |
7249 | 7249 | | |
7250 | 7250 | | |
7251 | | - | |
7252 | | - | |
| 7251 | + | |
| 7252 | + | |
7253 | 7253 | | |
7254 | 7254 | | |
7255 | 7255 | | |
| |||
8984 | 8984 | | |
8985 | 8985 | | |
8986 | 8986 | | |
8987 | | - | |
| 8987 | + | |
8988 | 8988 | | |
8989 | 8989 | | |
8990 | 8990 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments