Django calls itself a framework for perfectionists, whereas isn’t perfect
for locale Django admin in languages with grammatical cases. Please find a
description of an idea of one step towards perfection below.

PEP 3101 <https://www.python.org/dev/peps/pep-3101/> introduced compound
field names <https://pyformat.info/#getitem_and_getattr> in string
formatting for Python 2.7 and 3.2+. We can use it together with pgettext
<https://code.djangoproject.com/ticket/9988> (gettext with context) to
allow use of grammatical cases in Django admin translation texts.

If Meta.verbose_name was object of class Noun, we could translate a title
of model changelist view from `Select {} to change` to e.g. (pl) `Wybierz
{.accusative} do zmiany` (correct grammatical case for Polish).

Verbose name definition in Group model needed would be:

verbose_name = Noun(pgettext(‘nominative’, ‘group’),
accusative=pgettext(‘accusative’, ‘group’))

For backward compatibility, we could wrap existing verbose_names behind the
scenes with Noun with only one grammatical case, and fallback all other
grammatical cases to first and standard case (covers also compatibility for
lack of translations for grammatical cases).

Before completing the feature I would try to figure out minimal set of
grammatical cases for Django admin and Django locale languages that uses
grammatical cases to enable use of those cases in translations strings.

AFAIK this change would involve a couple of changes in Django core, but can
be fully backward compatible.

I am willing to implement the solution myself, if only I will have enough
free time.

I would be very happy to receive any feedback.

Also feel free to supplement potential Django issue description for the
case:
https://docs.google.com/document/d/16uEnKyiO9mn66JI64RtmMrEY_fyG2tWbI7OZIFE880o/edit

Regards,
Maciej

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CALYYG81wybpY7dJawEnwWOD7sj8PKSYbE-D2nzei2B014-syAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to