Ws 2759: Expand on sport translations#14090
Conversation
…sport-translation-extend-2
| // TODO - get a translation for this | ||
| const goalTypesHandled: Record<string, string> = { | ||
| Penalty: 'pen', | ||
| 'Own Goal': 'og', |
There was a problem hiding this comment.
Will flag to product we're missing this translatons
| } | ||
|
|
||
| const homeTeamTranslation = fetchTeamNameTranslation( | ||
| const homeTeamTranslation = translateTeamName( |
There was a problem hiding this comment.
Not fetching homeTeamTranslation and awayTeamTranslation inside of transformTeam function to save passing in Translations - but I'm not actually sure if this is better/ worse for performance?
There was a problem hiding this comment.
Pull request overview
This PR extends Sport Data Header (HeadToHead v2) localisation by adding new sport translation keys per service, translating period labels/grouped action labels, and translating minute/score numerals for non‑Western numeral services. It also refactors “Most Read” numeral selection into a shared utility and updates downstream imports (including Cypress).
Changes:
- Add new
translations.sportkeys (assists/penalties/HT/FT/ET/AET, venue/attendance, win-on-penalties phrasing) and populate them for multiple services. - Enhance HeadToHead v2 data transformation to apply label translations and numeral translations (scores, running scores, action minute labels), and surface translated values via new
translation/translatedfields in types. - Extract
serviceNumeralsintogetServiceNumeralsutility and update Most Read + Cypress usage.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| ws-nextjs-app/cypress/e2e/pageTypes/mostReadPage/mostReadAssertions.ts | Updates numeral utility import for Cypress assertions. |
| ws-nextjs-app/cypress/e2e/assertions/crossPlatformAssertion.ts | Updates numeral utility import for cross-platform Cypress checks. |
| src/app/models/types/translations.ts | Adds new sport translation keys and win-on-penalties shape. |
| src/app/lib/config/services/turkce.ts | Adds sport translations for Turkish. |
| src/app/lib/config/services/swahili.ts | Adds sport translations for Swahili. |
| src/app/lib/config/services/portuguese.ts | Adds sport translations for Portuguese. |
| src/app/lib/config/services/persian.ts | Adds sport translations for Persian. |
| src/app/lib/config/services/mundo.ts | Adds sport translations for Mundo (Spanish). |
| src/app/lib/config/services/hausa.ts | Adds sport translations for Hausa. |
| src/app/lib/config/services/arabic.ts | Adds sport translations for Arabic. |
| src/app/lib/config/services/afrique.ts | Adds sport translations for Afrique (French). |
| src/app/components/MostRead/utilities/getServiceNumerals.ts | Introduces shared numeral lookup utility. |
| src/app/components/MostRead/Canonical/Rank/index.tsx | Uses the shared numeral utility instead of inline logic. |
| src/app/components/MostRead/Amp/getRemoteDataScript/index.ts | Uses the shared numeral utility in AMP remote-data script. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/types.ts | Extends types to carry translated labels (translation, translated). |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/transformers/translateSportData.tsx | Implements sport label + numeral translations for H2H v2 data. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/transformers/translateSportData.test.tsx | Expands transformer unit tests for new translation behaviours. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/helpers/event-summary.ts | Updates fallback period label helper to accept translations. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/head-to-head-v2.tsx | Passes service into the translation transformer. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/components/score-details.tsx | Applies translated HT/FT labels in score details (incl. visually hidden text). |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/components/period.tsx | Displays translated period label when available. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/components/penalty-scores.tsx | Localises the win-on-penalties sentence using new translations. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/components/match-progress.tsx | Updates fallback period label invocation to new signature. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/components/actions.tsx | Passes sport translations down to score details. |
| src/app/components-webcore/SportDataHeader/head-to-head-v2/components/actions-time.tsx | Uses translated minute labels + translated penalty abbreviation for “pen” markers. |
| const aetTranslatedFallback = aetTranslation | ||
| ? { | ||
| value: aetTranslation, | ||
| accessible: aetTranslation, | ||
| } | ||
| : aetFallback; | ||
| const ftTranslatedFallback = ftTranslation | ||
| ? { | ||
| value: ftTranslation, | ||
| accessible: ftTranslation, | ||
| } | ||
| : ftFallback; |
Resolves JIRA: https://bbc.atlassian.net/browse/WS-2759
Summary
Translates the following info in the sports data header:
Some translations are out of scope, these include (but are not limited to)
["Y. Tielemans (44', 90'+4)", "E. Buendía (51')"](Country team names translated in previous PR)
Here is what assists look like:

Code changes
*Note, in deeply nested objects I have added a 'translated' key/ value pair rather than overwriting the value. This is because I saw at least one instance where the value was used in another context. So it seemed safer to add a new pair than override an existing pair.
Testing
http://localhost:7081/afrique/live/c7gk1vjglxn1t
http://localhost:7081/afrique/live/c7gk1vjglxn1t?renderer_env=live
http://localhost:7081/arabic/live/ckq1ll8qlmdmt?renderer_env=test
Useful Links