Localize category topic templates

Problem

Discourse’s Content Localization (manual and automatic via Discourse AI) does a great job localizing topic titles, posts, category names and category descriptions. However, category topic templates(categories.topic_template) cannot be localized. In multilingual communities, the composer prefill always appears in the site’s default language — for everyone.

Current behavior

  • CategoryLocalization stores name and description per locale (the Localizable concern provides “multi-locale name/description support” for Topic/Post/Category).
  • The composer always uses the unlocalized topic_template, regardless of the member’s interface locale.

Proposed solution

  • Add topic_template to CategoryLocalization (including the admin localization editor UI).
  • When a member opens the composer in a category, use the template matching their interface locale, with a fallback to the category’s default template if no localization exists.
  • The same gap applies to the newer per-category form templates: they can differ between categories, but there is no locale-aware variant within one category — multilingual setups would have to split their community into separate per-language categories to work around it.

Use case

We run a bilingual community (German default, English via automatic AI translation). Some categories provide structured composer templates with checklist items and an [event] block for the built-in date picker. English-speaking members currently get a German-only template. Our workaround is a single bilingual template (each label duplicated as “German / English” on one line), which works, but it is clunky for both editors and members and doubles the composer content.

Related

  • #32464 (localized categories route) — same localization surface, categories.
3 Likes

Following up on my original request with a concrete implementation sketch — happy to help with a PR if the direction sounds reasonable.

Problem: Category topic templates (categories.topic_template) are not localizable. The CategoryLocalization model and the Localizable concern only cover name and description, and the AI Content Localization pipeline skips templates accordingly. The composer always inserts the base-locale template, regardless of the user’s locale.

Use case: We run a bilingual (DE/EN) community on Discourse AI Content Localization with auto-translation in production. Translating posts/topics works great, but category templates for structured content — bug report forms with checklists, RSVP flows via [event] BBCode — cannot be duplicated per language, because functional BBCode must exist exactly once. The only workaround is a single template with awkward bilingual labels (“App-Version / App version:”), which hurts readability for everyone.

Proposal:

  1. Add a nullable topic_template text column to category_localizations
  2. Composer: if a localization for the user’s current locale exists, use its template; fall back to category.topic_template
  3. Expose/persist the field per locale in the category admin UI (next to localized name/description)
  4. Include topic_template in the AI Content Localization pipeline when translating categories (like description)

Migration is trivial (add_column :category_localizations, :topic_template, :text); the main work is composer selection logic and admin UI.

Alternatives considered:

  • Bilingual single template (current workaround) — breaks down with functional BBCode blocks
  • Theme component injecting per-locale text — fragile, no server-side validation, breaks API composers