Hi Strahinja,

To achieve what you are writing about, you should fork Django and change
gettext calls occurences as you described. For example line 290 in
helpers.py:

gettext('*Add* *another* %(*verbose_name*)s') % {'*verbose_name*':
capfirst(verbose_name)}

would be changed to:

gettext('*Add* *another* %(*verbose_name*)s' % {'*verbose_name*':
capfirst(verbose_name)})

Then after running [makemessages](
https://docs.djangoproject.com/en/1.11/ref/django-admin/#makemessages) you
would like to translate strings.

Regards,
Maciej

sob., 11 lis 2017 o 09:59 użytkownik Strahinja Lukic <
strahinja.lukic....@gmail.com> napisał:

> Hi Mathias,
>
> Thanks for sharing your example. I agree, there is no point attempting to
> provide automatic inflections.
>
> I was just wondering the following:
> At present, the message file for the app can be made to provide
> translations for all messages with inflected forms that appear in the app.
> However, wherever the app uses automatic inclusion of e.g. model names,
> ugettext() will look for translation *before* expanding the automatic
> text.
> In your example, ugettext("Save and add another %s") will return "Gem og
> tilføj endnu en %s", and "%s" will be translated separately.
> Thus, even if you provided separate translations for different genders in
> the message file, these translations will not be used.
> Imagine if ugettext() was looking for translation *after *expanding "%s".
> In that case, one would have the following sequence of transformations when
> "%s" stands for, e.g., "user"
> ugettext("Save and add another %s") -> ugettext("Save and add another
> user") -> <message provided in the message file for this specific case>.
>
> The translator would now be able to anticipate the messages that will
> appear in the app as a result of automatic inclusions and provide
> translations for each specific case.
>
> I would find such a feature immensely helpful.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django internationalization and localization" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-i18n+unsubscr...@googlegroups.com.
> To post to this group, send email to django-i18n@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-i18n.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django internationalization and localization" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-i18n+unsubscr...@googlegroups.com.
To post to this group, send email to django-i18n@googlegroups.com.
Visit this group at https://groups.google.com/group/django-i18n.
For more options, visit https://groups.google.com/d/optout.

Reply via email to