angrybeanie_wagtail/env/lib/python3.12/site-packages/wagtail/locales/utils.py

19 lines
462 B
Python
Raw Normal View History

2025-07-25 21:32:16 +10:00
from wagtail.models import Page, get_translatable_models
def get_locale_usage(locale):
"""
Returns the number of pages and other objects that use a locale
"""
num_pages = Page.objects.filter(locale=locale).exclude(depth=1).count()
num_others = 0
for model in get_translatable_models():
if model is Page:
continue
num_others += model.objects.filter(locale=locale).count()
return num_pages, num_others