Skip to content

WT-856 Get Firefox & Download Firefox Button Text In Wagtail#1250

Draft
dchukhin wants to merge 25 commits into
mainfrom
WT-856-get-firefox-download-firefox-text-in-cms
Draft

WT-856 Get Firefox & Download Firefox Button Text In Wagtail#1250
dchukhin wants to merge 25 commits into
mainfrom
WT-856-get-firefox-download-firefox-text-in-cms

Conversation

@dchukhin
Copy link
Copy Markdown
Collaborator

One-line summary

This pull request creates the concept of pre-translated text for Download Firefox buttons, so that we can avoid sending the same text to smartling over and over.

Significant changes and points to review

  • there is now a ButtonLabelSnippet, which is visible in the left-hand menu in Wagtail
wagtail-left-menu-choice
  • ButtonLabelSnippet values have been populated for each of the locales in Wagtail for "Get Firefox" and "Download Firefox" text
button-labels-list-in-wagtail
  • the DownloadFirefoxButtonBlocks' label field has been replaced with a foreign key to ButtonLabelSnippet, so Wagtail users can now select a snippet of pre-translated text
new-snippet-choice
  • DownloadFirefoxButtonBlocks still support "Custom Text", so Wagtail users can enter custom button text, that will be sent to smartling for translation

Issue / Bugzilla link

WT-856

Testing

  1. find a page with download firefox buttons. Use "Get Firefox" text, "Download Firefox" text, and other text
  2. run the migrations on this branch
  3. reload the page and observe that the buttons look the same to end users
  4. observe that in download firefox buttons in Wagtail, all "Get Firefox" text has been replaced with the "Get Firefox" snippet, all "Download Firefox" text has been replaced with the "Download Firefox" snippet, and other text is now in the "Custom Text" field. This should be true for en-US pages, and translations.
  5. observe that fallback pages show download firefox buttons in the correct language

@dchukhin dchukhin marked this pull request as draft April 13, 2026 19:09
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 65.57377% with 126 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.01%. Comparing base (43ca2a5) to head (26d0e33).

Files with missing lines Patch % Lines
...anagement/commands/create_pretranslated_phrases.py 0.00% 57 Missing ⚠️
springfield/cms/ftl_parser.py 0.00% 34 Missing ⚠️
...agement/commands/migrate_download_button_labels.py 92.30% 13 Missing ⚠️
springfield/cms/wagtail_hooks.py 66.66% 13 Missing ⚠️
springfield/cms/models/snippets.py 66.66% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1250      +/-   ##
==========================================
- Coverage   79.52%   79.01%   -0.52%     
==========================================
  Files         147      149       +2     
  Lines        9403     9764     +361     
==========================================
+ Hits         7478     7715     +237     
- Misses       1925     2049     +124     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@kkellydesign kkellydesign left a comment

Choose a reason for hiding this comment

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

I think the UI at the 'download button' component level works well. At the data level though, I think this could be a bit more flexible – closer to the existing FTL workflow – if it used the existing 'snippets' pattern, like this:

  • Have one snippet type called "Translation Strings" that you'd see on this list: http://localhost:8000/cms-admin/snippets/
  • The snippet has a field for a single text string, as well as a field for 'category'. That category field is what you'd filter by in the wagtail frontend. For example in this case download button. That could be a dropdown, which would require a migration when a new component type needs to use this pattern. But that would reduce the user error when these things are eventually revised.

EDIT: It may be easier to have "download button strings" be its own snippet category, and then every time we need a new one, we have to create it. That's probably ok too.

We already have the snippet pattern of sending strings off to Smartling, which adheres to the Wagtail Translations pattern of "base translation with alternates." So I think when it comes time to create another version of text to be added to the "Download Button collection of strings," the snippet workflow seems more intuitive to me.

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