According to gettext manual[1] one can use \u to uppercase the next char. But I have no idea whether "\u%(name)s" works. If it does not, a small patch for Django admin to fix this would be nice.
[1] http://www.gnu.org/software/gettext/manual/gettext.html#Interpolation-I On Thu, Sep 29, 2011 at 9:01 AM, Erik Wognsen <e...@unf.dk> wrote: > Yes, I have seen some of the languages use tricks like "object of type" and > slashes for gender ("%(name)s \"%(obj)s\" modificato/a correttamente.") > > But many times the indefinite noun will do as well ('employee "Xyz" was > changed...') , so maybe we can get the capitalization right? ('Employee > "Xyz" was...') > > Does gettext support something for that? > > Otherwise, the first letter of the message can be made uppercase directly > in Python, e.g. "msg = msg[0].upper() + msg[1:]" after msg is set in > contrib/admin/options.py. > > Regards, > Erik Wognsen > On Tue, Sep 27, 2011 at 20:47, Sergiy Kuzmenko <s.kuzme...@gmail.com>wrote: > >> In general noun interpolation is a non trivial task. It might be possible >> that for a limited subset of messages (addition, deletion and modification) >> there is a common denominator for an "alternative" verbose model name that >> will do the trick in all languages. But it might not be so. Different >> languages could require multiple word forms for what in Danish you describe >> as "definite version". >> >> Also in some cases, the context itself may be altered by the noun you are >> interpolating. For example, the phrase "No %(name)s found" could be >> translated in French as "Aucun %(name)s trouvé" if the noun is in masculine >> or "Aucune %(name)s trouvée" if the noun is in feminine. Even though this >> example does not directly relate to messages generated by Django admin, it >> gives an idea about complexities involved in generating messages on the fly. >> >> So I tend to think there is no easy fix for this. And yes, in some >> languages Django admin messages read funny. >> >> My way to deal with this problem is to construct a (sometimes rather >> artificial) translation string utilizing the "dictionary form" of the noun >> that is being interpolated. For example, when translating "No %(name)s >> found" I could have tried to say something like "No object of type %(name)s >> was found" instead. >> >> Sergiy >> >> >> On Monday, September 26, 2011, Erik Wognsen <r4m...@gmail.com> wrote: >> > Hi, >> > >> > django/contrib/admin/options.py contains the message 'The %(name)s >> "%(obj)s" was changed successfully.' and similar for "added" and "deleted" >> and some others. >> > >> > This works well in languages that only use an article for definiteness. >> But what about other languages? >> > >> > For example, in Danish "employee" is "ansat" but "the employee" is "den >> ansatte". The current translation for many languages including Danish simply >> uses a form of "%(name)s \"%(obj)s\" was changed successfully.". For >> example: 'ansat "Foo Bar" blev ....' or, in other words, '[lower case, >> indefinite form of model name] "Foo Bar" was changed successfully'. >> > >> > Is it possible to handle 'The %(name)s' such that the translator may >> specify an upper case and definite version of the model name? >> > >> > Regards, >> > Erik Wognsen >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "Django internationalization and localization" group. >> > To post to this group, send email to django-i18n@googlegroups.com. >> > To unsubscribe from this group, send email to >> django-i18n+unsubscr...@googlegroups.com < >> django-i18n%2bunsubscr...@googlegroups.com>. >> > For more options, visit this group at >> http://groups.google.com/group/django-i18n?hl=en. >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django internationalization and localization" group. >> To post to this group, send email to django-i18n@googlegroups.com. >> To unsubscribe from this group, send email to >> django-i18n+unsubscr...@googlegroups.com. >> >> For more options, visit this group at >> http://groups.google.com/group/django-i18n?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django internationalization and localization" group. > To post to this group, send email to django-i18n@googlegroups.com. > To unsubscribe from this group, send email to > django-i18n+unsubscr...@googlegroups.com. > > For more options, visit this group at > http://groups.google.com/group/django-i18n?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django internationalization and localization" group. To post to this group, send email to django-i18n@googlegroups.com. To unsubscribe from this group, send email to django-i18n+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-i18n?hl=en.