wagtail-translation adds translation capabilities to Wagtail CMS by using django-modeltranslation. The aim is to have a very clean implementation of single-tree Wagtail translations. This project was inspired by wagtail-modeltranslation because it is unnecessarily messy and not very maintainable.
-
Add
wagtail_translation
andmodeltranslation
toINSTALLED_APPS
in your settings.wagtail_translation
must appear before any apps with subclassed Page models in the list. -
Define languages used for translations (see modeltranslation docs).
-
Define and register
TranslationOptions
classes for every Page model. If said models don't have any additional fields to be translated, they still have to be registered with emptyTranslationOptions
. -
Run
./manage.py migrate
.TBD: additional actions to install in preexisting projects (which had migrations run before)
TBD: additional actions when translation languages are changed after running wagtail-translation migration
-
If you have custom managers on your
Page
submodels, make sure that such managers inherit fromwagtail_translation.manager.MultilingualPageManager
.
Dependency | Versions |
---|---|
wagtail | >=1.8,<1.12 |
django-modeltranslation | >=0.12 |
django | >=1.8,<2.0 |
- Include wagtail urls with i18n_patterns
- Add LocaleMiddleware to middleware list in your settings.