bedrock/docs
Steve Jalim 42ea7e3a76
Provide a hybrid list of locales drawn from CMS-backed and Django-backed sources (#15475)
* Refactor the logic for enumerating available locales for a CMS page

...so that we can use it independently of AbstractBedrockCMSPage._patch_request_for_bedrock()
in the enhancement to follow

* Ensure get_locales_for_cms_page ignores draft pages

* Set correct lang-picker options when different locales for a given path may be served by the CMS or the Django fallback view

* Expand prefer_cms to take args that tell us what locales are available in the Django fallback version of the page
* In prefer_cms annotate the request with lists of locales available in a CMS-backed version of the page and a Django-backed version
* Add a new jinja helper to select the most appropriate list of locales to pass to the lang picker UI element

* Add tests; drop support for using prefer_cms with the page() decorator

Making it support a list of automatically-detected Fluent files would make
the page() helper even busier, with little value: if we need to decorate a
page() view with prefer_cms, we can refactor it to be a regular Django view
and then decorate in the URLConf or on the view itself

(Had to commit all in one go, alas, due to pre-commit constraints)

* Add support for a dynamic callable of locales for a page

This is to satisfy situations like the current VPN RC where overall it's available in 10 locales,
but it's not consistently translated into all 10, so we can't claim that all pages are available
in all of those locales in the picker. This approach makes the locale derivation pluggable

* Use the new dynamic/callable approach to get locales with the _old_ VPN RC article page

(The version with data exported from Contentful, ahead of us moving it all to Wagtail)

* Update other parts of the codebase that may need to use the new lang-switcher code to cope with alt/fallback sources of locale info

* Rename helper func for getting locales to be more generic

* Update documentation for prefer_cms

* Fix regression due to a bad rebase

* Remove deprecated approach to passing in locale info

* Expand test coverage, fix comments/feedback

* Update import to be absolute not relative

* Change DB-hitting list comprehension to be a subquery, for better performance
2024-11-18 13:22:37 +04:00
..
_static Bug 816080: Upgrade Bedrock to latest Playdoh 2013-05-15 11:14:13 -07:00
_templates Fully remove old l10n uses and machinery (#11461) 2022-04-14 15:55:02 -07:00
architecture/decisions Add a positive consequence to the Wagtail ADR (#14473) 2024-04-17 09:28:42 +01:00
attribution Add data-cta-name to documentation (#15392) 2024-10-30 09:24:24 +00:00
images Update Glean documentation (#14736) 2024-07-03 09:30:19 +01:00
Makefile Minor dependency bump (#13210) 2023-06-01 15:10:33 +01:00
abtest.rst Update docs and code to remove GA3 references and match GA4 reality (#14910) 2024-10-08 14:53:08 +11:00
architectural-decisions.rst Add pre-commit hook for including the MPLv2 in all source code files (#10617) 2021-10-22 13:09:44 +01:00
attribution.rst Refresh attribution documentation (#13155) 2023-05-19 13:11:22 -07:00
banners.rst Remove home page fundraising banner (Issue #14015) (#14036) 2024-01-02 12:58:10 -06:00
browser-support.rst Update docs to reference Mozilla accounts (Fixes #137240) (#13814) 2023-10-23 09:31:34 -05:00
build-github.zsh Bug 816080: Upgrade Bedrock to latest Playdoh 2013-05-15 11:14:13 -07:00
cms.rst Provide a hybrid list of locales drawn from CMS-backed and Django-backed sources (#15475) 2024-11-18 13:22:37 +04:00
coding.rst Run docs through `blacken-docs` 2024-10-02 17:10:45 -07:00
conf.py Add background task queue support and use it for CMS image generation (#14617) 2024-06-04 14:27:34 +04:00
content-cards.rst Run docs through `blacken-docs` 2024-10-02 17:10:45 -07:00
contentful.rst Run docs through `blacken-docs` 2024-10-02 17:10:45 -07:00
contribute.rst Fix #14596: Remove pocket-mode 2024-10-11 11:45:33 -07:00
download-buttons.rst Omit non-essential fields from RTAMO flow (Fixes #14482) 2024-05-01 09:40:06 +01:00
index.rst Import config waffles to django waffles 🧇 2024-10-02 15:25:44 -07:00
install.rst Add docs on waffle switch migrations 2024-10-31 13:52:19 -07:00
l10n.rst Fix #14596: Remove pocket-mode 2024-10-11 11:45:33 -07:00
legal-docs.rst Add some docs for the privacy notice templates #14233 (#14562) 2024-05-21 11:01:33 -07:00
mozilla-accounts.rst Remove VPN + Relay bundle code (Fixes #15288) (#15290) 2024-10-15 11:39:04 +11:00
newsletters.rst Update docs to reference Mozilla accounts (Fixes #137240) (#13814) 2023-10-23 09:31:34 -05:00
pipeline.rst Fix #14596: Remove pocket-mode 2024-10-11 11:45:33 -07:00
redirects.rst Run docs through `blacken-docs` 2024-10-02 17:10:45 -07:00
send-to-device.rst Update newsletter IDs 2024-04-10 12:08:21 -07:00
sitemap.rst Clarify that it's data flowing around, not rendered sitemaps 2022-02-24 14:06:21 -05:00
task-queue.rst Add background task queue support and use it for CMS image generation (#14617) 2024-06-04 14:27:34 +04:00
testing.rst Run docs through `blacken-docs` 2024-10-02 17:10:45 -07:00
uitour.rst Update docs to reference Mozilla accounts (Fixes #137240) (#13814) 2023-10-23 09:31:34 -05:00
vpn-subscriptions.rst Run docs through `blacken-docs` 2024-10-02 17:10:45 -07:00