Skip to content

WT-856 Use Translated Text In Get/Download Firefox Buttons#1132

Draft
dchukhin wants to merge 32 commits intoWT-854-language-fallback-for-pagesfrom
WT-856-download-firefox-buttons
Draft

WT-856 Use Translated Text In Get/Download Firefox Buttons#1132
dchukhin wants to merge 32 commits intoWT-854-language-fallback-for-pagesfrom
WT-856-download-firefox-buttons

Conversation

@dchukhin
Copy link
Copy Markdown
Collaborator

@dchukhin dchukhin commented Mar 9, 2026

One-line summary

This pull request tries to use already-created translations for "Get Firefox" and "Download Firefox" buttons by rendering the text with ftl strings.

Significant changes and points to review

  • In order to not send the same text for translation from multiple places, we now have a FluentOrCustomTextBlock, which allows users to choose some pretranslated text ("Get Firefox", "Download Firefox"), or use custom text:
FluentOrCustomTextBlock FluentOrCustomTextBlockcutomtext
  • the FluentOrCustomTextBlock is used in the DownloadFirefoxButtonBlock
  • all previously created DownloadFirefoxButtonBlocks have had their text mapped to the new choices
  • similarly to the new block, the PreFooterCTASnippet now has a custom_label field for custom text that will be translated. Its label field has been renamed to pretranslated_label, and shows the same pre-translated choices as the FluentOrCustomTextBlock. Choosing "Custom text" allows the user to enter custom text that will be sent for translation.
PreFooterCTASnippet

Issue / Bugzilla link

WT-856

Testing

  1. log in to Wagtail, and find a page that uses the pre-footer snippet. For example, localhost:8000. Observe the value in the (non-firefox) template.
  2. change the value of the pre-footer call to action snippet to a pre-translated choice and view the page in en-US. Observe the updated label.
  3. change the value of the pre-footer call to action snippet to custom text and view the page in en-US. Observe the updated label.
  4. change the value of the es-MX pre-footer call to action snippet to a pre-translated choice and view the page in es-MX. Observe the updated label.
  5. change the value of the pre-footer call to action snippet to custom text and view the page in es-MX. Observe the updated label.
  6. Find a page that uses the download firefox button, and set the text value to be one of the pre-translated choices (for example, "Download Firefox"). Observe that the text in the template. Set another download button text to be some custom text.
  7. translate the page and observe that "Download Firefox" is not one of the translatable text fields, but it is already translated in the template. Observe that your custom text is one of the translatable text fields, and is not translated in the template.
  8. note that none of the pre-translated values should be sent for translation

@dchukhin dchukhin marked this pull request as draft March 9, 2026 20:49
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 43.24324% with 126 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.30%. Comparing base (9d2cc6c) to head (7adf009).

Files with missing lines Patch % Lines
...agement/commands/migrate_download_button_labels.py 27.58% 126 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##           WT-854-language-fallback-for-pages    #1132      +/-   ##
======================================================================
- Coverage                               79.24%   78.30%   -0.95%     
======================================================================
  Files                                     133      134       +1     
  Lines                                    8383     8600     +217     
======================================================================
+ Hits                                     6643     6734      +91     
- Misses                                   1740     1866     +126     

☔ 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.



def convert_pages(apps, schema_editor):
models_and_fields = [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This list needs to be updated with the new free form page 2026

except (json.JSONDecodeError, TypeError):
pass
if modified:
revision.save(update_fields=["content"])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Missing the other field names

from django.contrib.contenttypes.models import ContentType

page_models = [
apps.get_model("cms", name) for name in ("HomePage", "DownloadPage", "ThanksPage", "ArticleThemePage", "FreeFormPage", "WhatsNewPage")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here too

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