Allowing users to switch language
Since you are serving content that is available in multiple languages, you should let your users switch the site’s language. You are going to add a language selector to your site. The language selector will consist of a list of available languages displayed using links.
Edit the shop/base.html
template of the shop
application and locate the following lines:
<div id="header">
<a href="/" class="logo">{% trans "My shop" %}</a>
</div>
Replace them with the following code:
<div id="header">
<a href="/" class="logo">{% trans "My shop" %}</a>
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
<div class="languages">
<p>{% trans "Language" %}:</p>
<ul class="...