I am new to Django and I am working on a project with i18n, the fact is that I translated some variables using .manage.py makemessages / compilemessages my template file, but when I use it {% trans "my string" %} , I got the same "my string"for all languages.
What am I doing wrong? Here is the code for views.py and idioma.html
views.py:# some code here ...
def idioma(request):
output = _("Mensaje en espanol")
return render_to_response( 'idioma/idioma.html', { 'idioma' : output }, context_instance = RequestContext(request) )
idioma.html{% load i18n %}
< 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>
< input type="submit" value="Go" />
< /form>
La cadena es: {% trans idioma %}
{% trans "carro" %}
The application translates the idioma variable from .po and .mo files to locale / path / to / language /But it does not translate the string {% trans "carro"%}.
What's happening?
Thank you for your help!!!!
source
share