Skip to main content

The glue between django-modeltranslation and wagtail

Project description

https://readthedocs.org/projects/django-modeltranslation-wagtail/badge/?version=latest https://badge.fury.io/py/django-modeltranslation-wagtail.png https://circleci.com/gh/benjaoming/django-modeltranslation-wagtail.svg?style=shield

Keep-it-simple glue between django-modeltranslation and Wagtail.

Features

  • Field-based translation for Wagtail using django-modeltranslation

  • TODO Makes translated fields easily accessible to the Wagtail admin.

  • Sensible to the currently activated language.

  • The Page model isn’t modified (no migrations added to Wagtail), translations of title, seo_title and search_description are local to the translated models.

How to use

You create Wagtail models and activate them with a <yourapp>.translation module, just like you would with any other modeltranslation-based model.

In Wagtail, it’s the active language that decides what language you are editing in your translated model.

For instance, navigating to /en/wagtail/pages/add/<yourapp>/<yourmodel>/<ptr_id>/ will create a new page in English.

Drawback: There is currently no UI for the translation workflow. This means that users have to know that they need to switch /en/ with /fr/ in the URL path after creating an English entry to edit it in French.

When to use this

Actually, you might not want to use this! Consider carefully to use wagtail-modeltranslation as it has substantially improved by not hard-copying django-modeltranslation anymore.

If you need to have 1:1 translation for Pages or Snippets in Wagtail, you could use django-modeltranslation. However, wagtail-modeltranslation is a complex project that patches a lot of external code and therefore often breaks with the latest versions of Wagtail.

If you only need freeform translation (when pages in the page-tree aren’t translated 1:1 but translations exist independently from one another), look no further than either Wagtail’s built-in simple_translation or wagtail-localize.

Background

Originally, I was using wagtail-modeltranslation. The project has been sparsely maintained, but more seriously, it was monkey-patching Wagtail and using a hard-copy of the modeltranslation codebase instead of a dependency reference to django-modeltranslation. The latter has now been restored, which as lowered the motivation for this project.

A few years later, I returned to use wagtail-modeltranslation but once again found myself spending way too much time understanding non-merged PRs etc. To be fair, the project has been maintained in the meantime, but it was lacking behind and I couldn’t figure out what to do to use it with the latest version of Wagtail.

This project introduces a bit of naming hell. But remember it like this: django-modeltranslation-wagtail has wagtail at the end because it depends on django-modeltranslation, which depends on django.

Using django-modeltranslation or wagtail-modeltranslation?

Switching is easy!

Since this project is directly based on django-modeltranslation, the creation of fields in the database and django migrations remains the same. In case you are switching, just revisit your translation.py files and change the imports to point to modeltranslation_wagtail.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-modeltranslation-wagtail-0.4.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-modeltranslation-wagtail-0.4.tar.gz.

File metadata

  • Download URL: django-modeltranslation-wagtail-0.4.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.10

File hashes

Hashes for django-modeltranslation-wagtail-0.4.tar.gz
Algorithm Hash digest
SHA256 8ae17f59eeab94e2b997432c576bd82fad63df6879d57074120ccf43714f4ff3
MD5 306e5959404a9759b34bb68321064b4a
BLAKE2b-256 52c9fb32dd0e0e5c40b4dca4e9f12ecb1541adcab19226b3531050a1e1a8647b

See more details on using hashes here.

Provenance

File details

Details for the file django_modeltranslation_wagtail-0.4-py3-none-any.whl.

File metadata

  • Download URL: django_modeltranslation_wagtail-0.4-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.10

File hashes

Hashes for django_modeltranslation_wagtail-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3f3d35fe4bf6176d009da743fdd92a2affd2d3d8fc28ed974f200d501e0f09f4
MD5 fa3b71b1f87dab087149bbb3db2c749f
BLAKE2b-256 d5ff3e95d37d84d2dd701a3e93d61081d1d28638983b7e9256919697cb809ea7

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page