Django has built-in support for multiple languages and countries. Adapting Django projects to multiple languages and countries requires diving into three major topics, as defined by the software industry in general  :Internationalization, also known as i18n for short i(18 letters for 'nternationalizatio')n; localization, also known as l10n for short l(10 letters for 'ocalizatio')n; and time zones.
Django default i18n, L10n and time zone behavior
The good news about adapting a Django project to multiple languages and countries is Django projects are enabled by default to support this behavior, the bad news is that doing so still requires a fair amount of configuration and design choices, in addition to the major effort required to make the actual text translations.
Listing 13-1 illustrates the default configurations in
settings.py designed to influence i18n, L10n and timezone behavior in Django projects.
Listing 13-1. Default multi-language and multi-country Django configurations in settings.py
USE_I18N = True USE_L10N = True LANGUAGE_CODE = 'en-us' USE_TZ = True TIME_ZONE = 'UTC'
USE_I18N variable defines whether a Django project should use i18n. As you can see in listing 13-1,
USE_I18N defaults to True. This ensures a Django project is enabled to look for certain i18n queues in a project's structure and files (e.g. formatted strings, translation bundles). It's possible to set USE_I18N to False to this disable i18n checkups with the purpose of getting a minimal -- often negligible -- performance boost.
USE_L10N variable defines whether a Django project should format numbers and dates according to project's locale. Although a float number will be a float no matter where in the world a Django project is used, just as date will be a date, numbers and dates tend to vary how they're represented across the world. For example, the number 1,000.34 can also be represented as 1 000,34 -- note the space to separate thousands and comma to separate decimals -- depending on a region, similarly, the date December 31st 2020 can be represented as 12/31/2020 (month,day,year) in the United States, as well as 31/12/2020 (day/month/year) in France.
This content for Django 3.2 LTS is only available in the paid version.