diff --git a/docs/releases/6.3.md b/docs/releases/6.3.md index f88008739f6e..c99956d3a33d 100644 --- a/docs/releases/6.3.md +++ b/docs/releases/6.3.md @@ -91,3 +91,9 @@ To disable the automatic preview update feature, set [`WAGTAIL_AUTO_UPDATE_PREVI ## Upgrade considerations - changes affecting Wagtail customisations ## Upgrade considerations - changes to undocumented internals + +### Deprecation of the `{% locales %}` template tag + +The undocumented `locales` template tag will be removed in a future release. + +If access to JSON locales within JavaScript is needed, use `window.wagtailConfig.LOCALES` instead. diff --git a/wagtail/admin/templatetags/wagtailadmin_tags.py b/wagtail/admin/templatetags/wagtailadmin_tags.py index a54c10494f24..c63fbdb0712f 100644 --- a/wagtail/admin/templatetags/wagtailadmin_tags.py +++ b/wagtail/admin/templatetags/wagtailadmin_tags.py @@ -867,7 +867,15 @@ def locales(serialize=True): } for locale in Locale.objects.all() ] - return json.dumps(result) if serialize else result + + if serialize: + warn( + "The `locales` template tag will be removed in a future release.", + category=RemovedInWagtail70Warning, + ) + return json.dumps(result) + + return result @register.simple_tag