51. Treating translation errors
Next, we will address potential errors encountered during the development phase:
The first issue to consider is related to the LANGUAGE_CODE
setting in the settings.py
file. If this is set to a language code other than en-us
and you use special characters specific to that language (such as accents), you may encounter errors where certain information, like product prices, fails to display. This typically occurs due to the use of commas ,
as decimal separators instead of periods .
.
Note: These issues are most likely to appear on the main store page (due to price filters) and the checkout button (which also displays a price). Be sure to thoroughly test all pages. If your site functions as expected, you can disregard these instructions.
LANGUAGE_CODE = 'en-us'
To resolve this issue, add the {% load l10n %}
tag at the top of each HTML file experiencing problems. This tag instructs Django to bypass localization and display the values directly, preventing the formatting errors that may arise due to language-specific settings. Note that the specific files affected may vary depending on the user's configuration.
{% load l10n %}
In the affected HTML files, add {% load l10n %}
at the top of each page. Surround the problematic values with {% localize on %}
and {% localize off %}
to control the localization of special characters as shown in the example below:

Lastly, if you encounter any issues not covered in this documentation, consult the official Django documentation or email me at dantenavaza005@gmail.com.
The remaining steps are to automate email notifications to clients upon purchase confirmation, complete the product stock system, and develop the project’s front end!
Last updated