I plugged in i18n patterns module to my urls and added some languages:
urlpatterns += i18n_patterns(
path('blog/', include('blog.urls')),
path('contacts/', include('contacts.urls')),
path('signup/', views.signup, name='signup'),
path('login/', auth_views.login, {'template_name': 'login.html'}, name='login'),
path('logout/', auth_views.logout, {'next_page': 'login'}, name='logout'),
)
LANGUAGES = (
('ru', 'Russian'),
('en', 'English'),
('es', 'Spain'),
)
But the only language I see in urls its a language that I set up in LANGUAGE_CODE parameter and the only valid link I have it is a link with a language_code parameter. For example, now I see 'en', but I need to see 'ru' and 'es' and etc.. What should I need to do with it in order to get all another languages here? If I set up a prefix_default_language=False, so I couldn't even get a default language (and all others respectively) I got Page not found (404) error when I'm trying to use a template with set_language form. For instance, if I have a language_code == en, I got this error when I'm trying to switch it into ru language with the help of a form in my template (i got a link like: address:port/ru/blog). So, it seems that I need to use a view that will change a default language.
[name='home']
languages/
admin/
en/
^media\/(?P<path>.*)$
template:
<form action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{{ redirect_to }}" />
<select name="language">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
<input type="submit" value="Go" />
</form>