Installing django-parler

Install django-parler via pip using the following command:

pip install django-parler==1.9.2

Edit the settings.py file of your project and add 'parler' to the INSTALLED_APPS setting as follows:

INSTALLED_APPS = [    # ...    'parler',]

Also add the following code to your settings:

PARLER_LANGUAGES = {    None: (        {'code': 'en'},        {'code': 'es'},    ),    'default': {        'fallback': 'en',        'hide_untranslated': False,    }}

This setting defines the available languages en and es for django-parler. We specify the default language en and we indicate that django-parler should not hide untranslated content.

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.