Good day! I am trying to make a website in two languages, in Russian and English.
Russian by default. Configured localization, in the end, instead of the address /registration/ , /ru/registration/ and /en/registration/
The title placed in h1 is translated - it means the translation works, but the name of the form fields placed in has remained in Russian in both language urls. I use the latest Django 1.9, Python 3.
Below brought the clippings from the main files, help to understand.
settings.py
LANGUAGE_CODE = 'ru' LANGUAGES = ( ('ru', _('Russian')), ('en', _('English')), ) root urls.py
urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^i18n/', include('django.conf.urls.i18n')), ] urlpatterns += i18n_patterns( url(r'^$', views.home_page), url(r'', include('account.urls')), ) forms.py
from django.utils.translation import ugettext as _ class UserRegistration(forms.Form): ... last_name = forms.CharField(label=_(u'Π€Π°ΠΌΠΈΠ»ΠΈΡ')) templates / account / registration.html
{% load i18n %} <h1>{% trans "Π Π΅Π³ΠΈΡΡΡΠ°ΡΠΈΡ Π½ΠΎΠ²ΠΎΠ³ΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ" %}</h1> <form action="." method="post"> {{ form.as_p }} {% csrf_token %} <p><input type="submit" value="Log-in"></p> </form> locale / en / LC_MESSAGES / django.po
#: account/forms.py:21 msgid "Π€Π°ΠΌΠΈΠ»ΠΈΡ" msgstr "Last name" #: templates/account/registration.html:22 msgid "Π Π΅Π³ΠΈΡΡΡΠ°ΡΠΈΡ Π½ΠΎΠ²ΠΎΠ³ΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ" msgstr "Register new user"
_what function is used? - andreymal