[Answered ]-Sending localized messages to Django users

1👍

Have you tried localizing the message right before you display it?

In your view:

user.message_set.create(message="Message")

In your template

{% if messages %}
<ul>
    {% for message in messages %}
    <li>{% trans message %}</li>
    {% endfor %}
</ul>
{% endif %}

This way, you don’t have to store any odd characters in your database.

1👍

user.message_set.create(message=_("Message"))

… should work. Are you using the latest version of SQLite, does UTF-8 support have to be enabled somehow? Are you storing non-ascii characters in SQLite elsewhere?

Leave a comment