Reputation: 5865
I have inherited a Django project that needs i18n. I have done all the usual actions required for i18n that I usually do in other projects and that usually work. But on this one it was not working, it's Django 1.3 so I went to the docs on i18n and followed all the steps and yet it's not working.
I don't know what could have gone wrong, since I did not set up all the project myself I don't know which part of it could break i18n.
In base.html I added the typical language select from the docs + the LANGUAGE_CODE tag to get some feedback:
<form action="/i18n/setlang/" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{{ redirect_to }}" />
<select name="language">
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}">{{ language.name_local }} ({{ language.code }})</option>
{% endfor %}
</select>
Lang:{{ LANGUAGE_CODE }}
<input type="submit" value="Go" />
</form>
Whatever I do, the LANGUAGE_CODE always returns the default en-us or whatever I set in settings.
In which order should I check things? Where to start, what to change?
Upvotes: 0
Views: 1009
Reputation: 37500
According to the docs, LANGUAGE_CODE is set to the installation language code. Are you sure you've changed it from en-us in your settings file?
Have you tried printing the language code out at the end of your settings file and then running in a non-deamon mode so you can see it's output? Personally, I use multi-part configuration files and have previously had issues where latter settings files have altered something I expected to work further down the line. Is that a possibility?
If it looks right at the end of the settings file then it's probably not being fed through to the template properly. You could try pushing it through yourself like this to be sure.
One other thing to check; are you sure it's not settings.LANGUAGE_CODE you need? I can't remember whether that's just in the model off the top of my head.
Upvotes: 1