Commit 1bc79e9
Documents the requirement for ``django.middleware.locale.LocaleMiddleware``
in the consumer's MIDDLEWARE stack to make the API's
``gettext_lazy``-wrapped ``verbose_name`` / ``help_text`` /
``@admin.action(description=…)`` proxies resolve to the active
request locale.
The API package itself has no ``activate()`` call — by design, it
piggybacks on Django's standard ``LocaleMiddleware.process_request``
(which calls ``translation.activate(language)`` after
``get_language_from_request``). With the middleware enabled, the
JSON payload returns ``verbose_name`` etc. in the user's language;
without it, the proxies stay un-resolved and read as English
regardless of ``Accept-Language``.
Django's ``startproject`` template does NOT include
``LocaleMiddleware`` by default, so a stock consumer who adds
this package gets the English-only behaviour and a confusing gap
between Django's own chrome (which IS translated when
``LocaleMiddleware`` is present in other paths) and the SPA's
payloads. Calling this out in the README + showing the exact
``MIDDLEWARE`` line is the smallest doc change that closes the
"why aren't my translated verbose_names showing up?" question.
Half of #630 — the wire-side gap — is now documented. The SPA's
own chrome strings (``"Add"`` / ``"Search"`` / ``"Loading…"``) are
still hard-coded English; the message-catalog work is staged for a
separate session.
Co-authored-by: Martin Castro Laminrs <mcastro@laminr.ai>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f8f6fda commit 1bc79e9
1 file changed
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
753 | 799 | | |
754 | 800 | | |
755 | 801 | | |
| |||
0 commit comments