WT-856 Use Translated Text In Get/Download Firefox Buttons#1132
Draft
WT-856 Use Translated Text In Get/Download Firefox Buttons#1132
Conversation
…ocale when the requested locale page is not found
Note: this logic shouldn't be needed, since all of the locales should be present in the database, but in case one of the locale records is removed from the database, but the locale is still referenced in the code (for example, in the settings), this logic will handle it.
CANONICAL_LANG matches LANG, unless a page is served for a fallback locale. In this case, the template can determine which context variable (LANG or CANONICAL_LANG) to use in each relevant place.
when a user requests a page and is given content for a fallback locale, the page links in the content should match the requested URL's locale.
…ent from alias locale URL when alias locale has no content
… alias Locale does not exist in the database
…when alias Locale does not exist in the database
this fixes an error where translating a page into the new Locales was causing a server error, because wagtail-localize was not able to correctly find the root page in the new Locale.
…s or strings that need translation
The separation: - makes the logic more readable - avoids a scenario where the middleware intercepts the request and returns a Wagtail page when it should not
…h-2 home page sites
Previously, the middleware's Accept-Language
redirect was hardcoding Wagtail url_path prefixes
as /home and /home-{locale}, which only works when
the site root page is at depth 2. In environments
where Site.root_page is at a different depth (for
example at depth 3 with url_path=/home/home/), the
hardcoded prefixes were not matching pages,
causing 404s instead of redirects for Wagtail
Locales that did not have a specific page.
…d-firefox-buttons
maribedran
reviewed
Mar 11, 2026
|
|
||
|
|
||
| def convert_pages(apps, schema_editor): | ||
| models_and_fields = [ |
Collaborator
There was a problem hiding this comment.
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"]) |
Collaborator
There was a problem hiding this comment.
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") |
- include FreeFormPage2026 in models being updated - make sure convert_revisions reads the appropriate locale and runs only for relevant page types - preserve non-English snippet custom labels
we avoid an error even if some CharFields have a None value by forcing None values to be ''
…d-firefox-buttons
…d-firefox-buttons
maribedran
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
FluentOrCustomTextBlock, which allows users to choose some pretranslated text ("Get Firefox", "Download Firefox"), or use custom text:FluentOrCustomTextBlockis used in theDownloadFirefoxButtonBlockDownloadFirefoxButtonBlocks have had their text mapped to the new choicesPreFooterCTASnippetnow has acustom_labelfield for custom text that will be translated. Itslabelfield has been renamed topretranslated_label, and shows the same pre-translated choices as theFluentOrCustomTextBlock. Choosing "Custom text" allows the user to enter custom text that will be sent for translation.Issue / Bugzilla link
WT-856
Testing