I included the following in the settings.py:
LANGUAGES = ( ('en', 'English'), ('ru', 'Russian'), ) LANGUAGE_CODE = 'en-us' USE_I18N = True
marked the strings to be translated
_('Enterprise') # _ is lazy translate
included this in my URLCOnf:
url(r'^i18n/', include('django.conf.urls.i18n'))
created the locale folder and did this:
python manage.py makemessages -l ru
translated the strings and did this:
python manage.py compilemessages
wrote this form:
<form action="/i18n/setlang/" method="post"> {% csrf_token %} <input name="next" type="hidden" value="/" /> <select name="language"> {% for lang in LANGUAGES %} <option value="{{ lang.0 }}">{{ lang.1 }}</option> {% endfor %} </select> <input type="submit" value="Translate" /> </form>
I think I did all the steps to make it work but seems like I doing something wrong or missing something.
When use the form and try to translate and print request.LANGUAGE_CODE
, it is showing me expected value. But the strings remain in the same language as they were
What is wrong here?