Lesson 16 / 22 · Commentail 1.3.2
Commentail UI and email support en, ru, de, fr, es and pt-br. User comments and moderator-entered rejection reasons retain their original text. Changing the interface language does not translate them.
Enable project languages
Use the host's standard Django/Wagtail language mechanism. Add the required codes in settings:
from django.utils.translation import gettext_lazy as _
LANGUAGE_CODE = "en"
LANGUAGES = [("en", _("English")), ("ru", _("Russian"))]
# Keep the existing LocaleMiddleware after SessionMiddleware and before CommonMiddleware.
# If WAGTAILADMIN_PERMITTED_LANGUAGES is restricted, add these languages there too.
Do not duplicate LocaleMiddleware. Use the site's existing language switch. If none exists, follow Django's set_language integration with POST and CSRF instead of changing global LANGUAGE_CODE per visitor.
Check English and Russian pages, form errors and the moderator admin. Discussions belong to a Site and a specific target; separate translated Pages should not be assumed to share comments. For translated Site root trees, check publication and Site membership; 1.3.2 fixes access in that scenario.
The job saves the recipient's language. The worker's language therefore does not turn all notices into English. Host template wording needs its own compiled project translations.
Configure exact hostnames
Technical settings resolve from library defaults through default to the exact Site.hostname:
COMMENTAIL = {
"default": {"AUTHOR_LIMIT_PER_HOUR": 20},
"forum.example.org": {"AUTHOR_LIMIT_PER_HOUR": 40},
}
Use forum.example.org, without scheme, port or path. Configure port and root page on the Wagtail Site. Project-wide OBJECT_ADAPTERS and RULES_CSV_* belong only in default.
For different CAPTCHA registrations by hostname, supply both keys in each CAPTCHA_OPTIONS override. The dictionary is replaced as a whole; a secret-only override does not inherit the default site key.
Check isolation
For each domain verify the public page, sender-facing site name, confirmation URLs and editorial group permissions. Guest proofs and quotas are Site-scoped. If hostname/root is wrong, correct the Site rather than bypassing adapter checks.
Related lessons
- 2. Add Commentail to an existing Wagtail site
- 15. Avatars, display names and dynamic templates
- 19. Production nginx, caching and user data
Choose a sign-in method or comment as a guest below.