Django admin and messages

194 views
Skip to first unread message

Cristiano Coelho

unread,
Feb 20, 2016, 2:51:27 PM2/20/16
to Django developers (Contributions to Django itself)
Hello,

It seems that all admin "sucess" (and others) messages are hardcoded (almost, actually translations) into the methods that use them and can not be easily changed (like 'The %(name)s "%(obj)s" was added successfully. You may add another %(name)s below.').
This is causing some issues on languages with higher gender usage, like spanish, that you can get into texts like 'El Persona "Id: 123" .....' (should be La Persona), so it would be convenient to be able to easily change these messages so you could just change it to "Object added successfully" or something to prevent the above issue.

Looking through the file django/contrib/admin/options.py you can see the huge usage of texts defined deep into the methods, which makes it impossible to override any of them.

Cristiano Coelho

unread,
Mar 1, 2016, 8:42:05 PM3/1/16
to Django developers (Contributions to Django itself)
Looking it deeper it seems mostly like a translation issue for the spanish (and maybe other) languages, since in some cases both gender articles are added ( "el/la" ) to make it generic but for the specific case I pointed above it is missing.


msgid ""
"The %(name)s \"%(obj)s\" was added successfully. You may edit it again below."
msgstr
""
"Se añadió con éxito el %(name)s \"%(obj)s. Puede editarlo de nuevo abajo."

Should be changed to

msgid ""
"The %(name)s \"%(obj)s\" was added successfully. You may edit it again below."
msgstr
""
"Se añadió con éxito el/la %(name)s \"%(obj)s. Puede editarlo/a de nuevo abajo."

The same happens for some other translations below this one. I couldn't find why is it different for some and not for others, but "el/la" is definitely better than "el" and having a female object following it.
Another approach for gender languages like spanish would be to use "el objeto %(obj)" rather than "el/la %(obj)".

Cristiano Coelho

unread,
Mar 1, 2016, 9:02:17 PM3/1/16
to Django developers (Contributions to Django itself)

Claude Paroz

unread,
Mar 2, 2016, 4:45:24 AM3/2/16
to Django developers (Contributions to Django itself)
Le mercredi 2 mars 2016 02:42:05 UTC+1, Cristiano Coelho a écrit :
Another approach for gender languages like spanish would be to use "el objeto %(obj)" rather than "el/la %(obj)".

That's exactly what we are doing for French.

Claude

Cristiano Coelho

unread,
Mar 3, 2016, 9:06:15 PM3/3/16
to Django developers (Contributions to Django itself)
By "we are doing" do you mean that's how it is translated by django, or are you patching translations on your projects? Any ideas why would it be different for spanish? It really burns my eyes seeing those grammar mistakes :D

Ramiro Morales

unread,
Mar 3, 2016, 9:31:19 PM3/3/16
to django-d...@googlegroups.com
On Thu, Mar 3, 2016 at 11:06 PM, Cristiano Coelho <cristia...@gmail.com> wrote:
By "we are doing" do you mean that's how it is translated by django, or are you patching translations on your projects? Any ideas why would it be different for spanish? It really burns my eyes seeing those grammar mistakes :D

You could the es_AR translation. I think we have all these cases covered.

--
Ramiro Morales
@ramiromorales

Cristiano Coelho

unread,
Mar 3, 2016, 9:41:25 PM3/3/16
to Django developers (Contributions to Django itself)
The issue is that we do not force any particular es language, it is pretty much up to the browser so it can be es, es_AR, es_UY etc. And it is not really an issue with this spanish project (all susscess messages are not shown) but a translation issue with spanish translations in general
Reply all
Reply to author
Forward
0 new messages