Skip to content

Fix Untranslated FTL Text In Alias Locales#1519

Draft
dchukhin wants to merge 6 commits into
mainfrom
fallback-locale-ftl-strings
Draft

Fix Untranslated FTL Text In Alias Locales#1519
dchukhin wants to merge 6 commits into
mainfrom
fallback-locale-ftl-strings

Conversation

@dchukhin

Copy link
Copy Markdown
Collaborator

One-line summary

This pull request updates logic, so that when a page exists in a fallback locale and is served at an alias locale, the FTL strings for the page are served from the alias FTL files, not the fallback FTL files.

Significant changes and points to review

When a page exists in a fallback locale and is served at an alias locale, the FTL strings are currently served either from the fallback locale's FTL strings, or English.

Here is an example to demonstrate the issue:

  • a page exists in pt-BR
  • a page does not exist in pt-PT
  • the pt-BR FTL files does not have "Download Firefox" translated
  • the pt-PT FTL files have "Download Firefox" translated
  • a user requests the pt-PT URL, so we serve the pt-BR page at the pt-PT URL
  • when rendering the page, we attempt to get the pt-BR FTL strings, and fall back to English
  • as a result, the user sees "Download Firefox", even though it is translated in the pt-PT FTL files

This pull request:

  • updates logic in lib/l10n_utils/__init__.py to use the alias locale when building fluent locales on requests for an alias locale when the fallback locale content is served
  • adds tests to assert the expected behavior

Issue / Bugzilla link

Testing

  1. Log in to the Wagtail admin interface
  2. Find (or create) a published pt-BR CMS page with no pt-PT translation (for example, http://localhost:8000/pt-BR/test-free-form-page-2026/)
  3. Go to the pt-PT URL for the page (http://localhost:8000/pt-PT/test-free-form-page-2026/)
  4. Observe the following are now translated into pt-PT (on the main branch they are not):
    a. in the "Navegador" dropdown, see "Download Firefox" (should be "Transferir o Firefox")
    b. in the "Funcionalidades" dropdown, see "Protection" (should be "Proteção"), "Control" (should be "Controlo"), "About Firefox Features" (should be "Sobre Firefox funcionalidades")

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.11%. Comparing base (3e52cdb) to head (cb813fd).

Files with missing lines Patch % Lines
lib/l10n_utils/__init__.py 91.66% 1 Missing ⚠️
lib/l10n_utils/fluent.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1519   +/-   ##
=======================================
  Coverage   87.10%   87.11%           
=======================================
  Files         151      151           
  Lines       10503    10524   +21     
=======================================
+ Hits         9149     9168   +19     
- Misses       1354     1356    +2     

☔ View full report in Codecov by Harness.
📢 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.

@dchukhin
dchukhin marked this pull request as draft June 17, 2026 19:45
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.

1 participant