Skip to content

Commit

Permalink
Start deprecation for the locales as a template tag
Browse files Browse the repository at this point in the history
- This was only used by our JS config globals and can now be removed in a future release
  • Loading branch information
lb- authored and laymonage committed Sep 25, 2024
1 parent ee1cb91 commit 429732f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/releases/6.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 9 additions & 1 deletion wagtail/admin/templatetags/wagtailadmin_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 429732f

Please sign in to comment.