Skip to content

Ws 2759: Expand on sport translations#14090

Open
Isabella-Mitchell wants to merge 24 commits into
latestfrom
WS-2759-sport-translation-extend-2
Open

Ws 2759: Expand on sport translations#14090
Isabella-Mitchell wants to merge 24 commits into
latestfrom
WS-2759-sport-translation-extend-2

Conversation

@Isabella-Mitchell
Copy link
Copy Markdown
Contributor

@Isabella-Mitchell Isabella-Mitchell commented Jun 3, 2026

Resolves JIRA: https://bbc.atlassian.net/browse/WS-2759

Summary

Translates the following info in the sports data header:

  • Assists
  • Penalties
  • HT/half time
  • FT/full time
  • ET/extra time
  • After extra time
  • wins on penalties
  • Scores
  • Minutes (e.g. 9' and 45'+2)
  • Minutes next to player scores (inc Pen text)
Screenshot 2026-06-04 at 11 02 20 Screenshot 2026-06-04 at 09 42 13

Some translations are out of scope, these include (but are not limited to)

  • Accessible event summary and visually hidden text (follow up ticket for comprehensive A11y AT translations)
  • Player names
  • Minutes next to Grouped actions e.g. Assists. This is much harder to do since it comes in a string, e.g. ["Y. Tielemans (44', 90'+4)", "E. Buendía (51')"]
  • Own goal text next to player scores (to flag to product)

(Country team names translated in previous PR)

Here is what assists look like:
Screenshot 2026-06-04 at 11 04 24

Code changes

  • Add new translations for initial services. (Further services to follow)
  • Expand translations 'dataTransformer' (This handles instances where we get strings from the data, e.g. teamName)
  • Add lots of unit tests for this
  • Surface translated values in child components*
  • Fetch translations in child components where hard-coded translations are used (e.g. Penalities)
  • Extract serviceNumerals into getServiceNumerals utility and update Most Read + Cypress usage.

*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

  1. Storybook, you can use the service toggle to see translations
  2. Local links:
    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

Base automatically changed from WS-2706-world-cup-team-name-translations to latest June 3, 2026 13:00
// TODO - get a translation for this
const goalTypesHandled: Record<string, string> = {
Penalty: 'pen',
'Own Goal': 'og',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will flag to product we're missing this translatons

}

const homeTeamTranslation = fetchTeamNameTranslation(
const homeTeamTranslation = translateTeamName(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@Isabella-Mitchell Isabella-Mitchell marked this pull request as ready for review June 4, 2026 10:09
@Isabella-Mitchell Isabella-Mitchell requested a review from Copilot June 4, 2026 10:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sport keys (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/translated fields in types.
  • Extract serviceNumerals into getServiceNumerals utility 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.

Comment thread src/app/models/types/translations.ts
Comment on lines +83 to 94
const aetTranslatedFallback = aetTranslation
? {
value: aetTranslation,
accessible: aetTranslation,
}
: aetFallback;
const ftTranslatedFallback = ftTranslation
? {
value: ftTranslation,
accessible: ftTranslation,
}
: ftFallback;
@Isabella-Mitchell Isabella-Mitchell changed the title Ws 2759 sport translation extend 2 Ws 2759: Expand on sport translations Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants