Format localization
Depending on the user’s locale, you might want to display dates, times, and numbers in different formats. Localized formatting can be activated by changing the USE_L10N
setting to True
in the settings.py
file of your project.
When USE_L10N
is enabled, Django will try to use a locale-specific format whenever it outputs a value in a template. You can see that decimal numbers in the English version of your site are displayed with a dot separator for decimal places, while in the Spanish version, they are displayed using a comma. This is due to the locale formats specified for the es
locale by Django. You can take a look at the Spanish formatting configuration at https://github.com/django/django/blob/stable/4.0.x/django/conf/locale/es/formats.py.
Normally, you will set the USE_L10N
setting to True
and let Django apply the format localization for each locale. However, there might be situations in which you don’t want to use localized values. This...