Preparing our project for internationalization

Let's prepare our project to use different languages. We are going to create an English and a Spanish version for our shop. Edit the settings.py file of your project and add the following LANGUAGES setting to it. Place it next to the LANGUAGE_CODE setting:

LANGUAGES = (    ('en', 'English'),    ('es', 'Spanish'),)

The LANGUAGES setting contains two tuples that consist of a language code and a name. Language codes can be locale-specific, such as en-us or en-gb, or generic, such as en. With this setting, we specify that our application will only be available in English and Spanish. If we don't define a custom LANGUAGES setting, the site will be available in all the languages that Django is translated ...

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.