What problem does it solve?
Adding localization support to Discourse models involves many coordinated pieces—database tables, serializers, Guardian checks, preloading, editing UI, and AI backfill jobs—and missing any one of them causes N+1 queries, broken fallbacks, or leaked localization rows.
Core Features & Use Cases
- Core Model Pattern: Guides adding
Localizable models, <Model>Localization tables with LocaleMatchable, unique (model_id, locale) indexes, and get_localization fallback behavior.
- Hot-Route Safety: Enforces
includes(:localizations) preloading on discovery, list, and site JSON routes so serializers never trigger N+1 queries.
- Editing UI & API Rules: Defines Guardian authorization, server-side param validation, and the rule that edit surfaces show source values rather than localized display values.
- discourse-ai Boundaries: Keeps AI detection, backfill, and localizer jobs inside
plugins/discourse-ai, skipping source-locale and self translations.
- Use Case: When making Sidebar sections or Groups localizable, follow the checklist to ship the data model, serializer preloading, admin editing UI, and discourse-ai backfill with full test coverage.
Quick Start
Use the discourse-content-localization skill to plan and implement localization support for the Group model including serializers, editing UI, and tests.