Re: create_object error
On Thu, 2007-04-05 at 17:09 +0200, Michael Radziej wrote: > On Thu, Apr 05, Marcelo Ramos wrote: > > > es_AR: > > > > #: views/generic/create_update.py:43 > > #, python-format > > msgid "The %(verbose_name)s was created successfully." > > msgstr "Se creó con éxito %(verbose_name)." > > this should be > > msgstr "Se creó con éxito %(verbose_name)s." > > (note the 's' before '.') Whoops... we aren't checking message string formats in compile-messages.py (or rather, in our call to msgfmt). I've just checked in a change to compile-messages.py that will detect these errors now. Turns out there are a *lot* of such bugs in our translations (unsurprisingly). Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: create_object error
2007/4/5, Michael Radziej <[EMAIL PROTECTED]>: > > On Thu, Apr 05, Marcelo Ramos wrote: > > > es_AR: > > > > #: views/generic/create_update.py:43 > > #, python-format > > msgid "The %(verbose_name)s was created successfully." > > msgstr "Se creó con éxito %(verbose_name)." > > this should be > > msgstr "Se creó con éxito %(verbose_name)s." > > (note the 's' before '.') Right! I fixed that in django.po and the problem is gone! I will contact the es_AR translation mantainer about this. Thanks very much Michael. Regards. -- Marcelo Ramos Fedora Core 6 | 2.6.19 Socio UYLUG Nro 125 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: create_object error
On Thu, Apr 05, Marcelo Ramos wrote: > es_AR: > > #: views/generic/create_update.py:43 > #, python-format > msgid "The %(verbose_name)s was created successfully." > msgstr "Se creó con éxito %(verbose_name)." this should be msgstr "Se creó con éxito %(verbose_name)s." (note the 's' before '.') Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: create_object error
2007/4/5, Malcolm Tredinnick <[EMAIL PROTECTED]>: [...] > In [1]: from django.utils.translation import activate, gettext > > In [2]: gettext("The %(verbose_name)s was created successfully.") % > {"verbose_name": "xyzzy"} > Out[2]: 'The xyzzy was created successfully.' > > In [3]: activate('es') > > In [4]: gettext("The %(verbose_name)s was created successfully.") % > {"verbose_name": "xyzzy"} > Out[4]: 'El xyzzy se ha creado correctamente.' > > In [5]: activate('de') > In [6]: gettext("The %(verbose_name)s was created successfully.") % > {"verbose_name": "xyzzy"} > Out[6]: 'xyzzy wurde erfolgreich angelegt.' > > In particular, what happens when you use activate() for your preferred > locale and then run the gettext() test? I found it works with the locale "es" but not with the "es_AR". The only difference i find about that specific translation in the .po's is that es_AR has accented characters and es has not: es: #: views/generic/create_update.py:43 #, python-format msgid "The %(verbose_name)s was created successfully." msgstr "El %(verbose_name)s se ha creado correctamente." es_AR: #: views/generic/create_update.py:43 #, python-format msgid "The %(verbose_name)s was created successfully." msgstr "Se creó con éxito %(verbose_name)." When I changed LANGUAGE_CODE to es instead of es_AR it worked fine but es_AR will probably fail if i use create_update.update_object() because the translation for a successfull update has accented characters. Are the accented chars the problem? Maybe it is related with the problem reported in the email with Subject: svn trunk broken since [4919], encoding problems. Regards. -- Marcelo Ramos Fedora Core 6 | 2.6.19 Socio UYLUG Nro 125 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: create_object error
Marcelo, On Wed, 2007-04-04 at 17:46 -0300, Marcelo Ramos wrote: > After submitting a form using a generic view I get this error: > > Request Method: POST > [...] > Exception Type: ValueError > Exception Value: incomplete format > Exception Location: > /usr/lib/python2.3/site-packages/django/views/generic/create_update.py > in create_object, line 43 > > It seems an error with the format given to gettext(): > > request.user.message_set.create(message=gettext("The %(verbose_name)s > was created successfully.") % {"verbose_name": > model._meta.verbose_name}) > > Is that a bug or a feature? I checked that model._meta.verbose_name > has the correct value then i'm a bit lost here. > > I'm working with a svn copy of revision 4926 (today). I'm having some trouble repeating this problem. Does the following experiment work for you (I'm doing this under the shell from "manage.py shell" in a Django project)? In [1]: from django.utils.translation import activate, gettext In [2]: gettext("The %(verbose_name)s was created successfully.") % {"verbose_name": "xyzzy"} Out[2]: 'The xyzzy was created successfully.' In [3]: activate('es') In [4]: gettext("The %(verbose_name)s was created successfully.") % {"verbose_name": "xyzzy"} Out[4]: 'El xyzzy se ha creado correctamente.' In [5]: activate('de') In [6]: gettext("The %(verbose_name)s was created successfully.") % {"verbose_name": "xyzzy"} Out[6]: 'xyzzy wurde erfolgreich angelegt.' In particular, what happens when you use activate() for your preferred locale and then run the gettext() test? Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: create_object error
Hey Marcelo, On Thu, 2007-04-05 at 01:34 -0300, Marcelo Ramos wrote: [...] > Well, it seems to be just a syntax error: > > request.user.message_set.create(message=gettext("The %(verbose_name)s > was created successfully." % {"verbose_name": > model._meta.verbose_name})) > > Remove the ) after successfully." and add it in the end of the line. > > Isn't the correct syntax > gettext(".. %(foo) .." % {'foo': 'bar'} )) instead of > gettext(".. %(foo) ..") % {'foo': 'bar'} ) ? No, it should be the second version. The reason is that you want to translate the string with the format markers unsubstituted. That is, the translators should see "this is a string with %(foo)s" and that is the string gettext() will use to extract the translation from the message catalog. Only after extracting the translation, will Python substitute in the parameter values. For some reason, the gettext call is not returning something with a %(verbose_name)s in it. Why this is happening is still a mystery to me, but I haven't had a chance to look at it too deeply yet. Can you check the PO file for your locale and make sure there isn't some silly translation error in that string. It should include %(verbose_name)s in the translated string and nothing else? > But another problem remains: the string is not being translated here. That's expected, for the reasons mentioned above: with the parameters substituted into the string, it is no longer an exact match for anything in the translation catalog. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: create_object error
2007/4/4, Malcolm Tredinnick <[EMAIL PROTECTED]>: > > Hi Marcelo, > > On Wed, 2007-04-04 at 17:46 -0300, Marcelo Ramos wrote: > > After submitting a form using a generic view I get this error: > > > > Request Method: POST > > [...] > > Exception Type: ValueError > > Exception Value: incomplete format > > Exception Location: > > /usr/lib/python2.3/site-packages/django/views/generic/create_update.py > > in create_object, line 43 > > > > It seems an error with the format given to gettext(): > > > > request.user.message_set.create(message=gettext("The %(verbose_name)s > > was created successfully.") % {"verbose_name": > > model._meta.verbose_name}) > > > > Is that a bug or a feature? I checked that model._meta.verbose_name > > has the correct value then i'm a bit lost here. > > Me, too. That looks unexpected. I've been trying to iron out a few i18n > problems during the last few days, so it's possible that either (a) I've > introduced a new bug or (b) fixing an older problem has exposed this. Well, it seems to be just a syntax error: request.user.message_set.create(message=gettext("The %(verbose_name)s was created successfully." % {"verbose_name": model._meta.verbose_name})) Remove the ) after successfully." and add it in the end of the line. Isn't the correct syntax gettext(".. %(foo) .." % {'foo': 'bar'} )) instead of gettext(".. %(foo) ..") % {'foo': 'bar'} ) ? But another problem remains: the string is not being translated here. If you need any help or feedback i'm here to help. Regards. -- Marcelo Ramos Fedora Core 6 | 2.6.19 Socio UYLUG Nro 125 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: create_object error
Hi Marcelo, On Wed, 2007-04-04 at 17:46 -0300, Marcelo Ramos wrote: > After submitting a form using a generic view I get this error: > > Request Method: POST > [...] > Exception Type: ValueError > Exception Value: incomplete format > Exception Location: > /usr/lib/python2.3/site-packages/django/views/generic/create_update.py > in create_object, line 43 > > It seems an error with the format given to gettext(): > > request.user.message_set.create(message=gettext("The %(verbose_name)s > was created successfully.") % {"verbose_name": > model._meta.verbose_name}) > > Is that a bug or a feature? I checked that model._meta.verbose_name > has the correct value then i'm a bit lost here. Me, too. That looks unexpected. I've been trying to iron out a few i18n problems during the last few days, so it's possible that either (a) I've introduced a new bug or (b) fixing an older problem has exposed this. I'll keep this on my list and try to replicate it when I get a chance. I'm very interested to hear about any regressions like this in the i18n framework at the moment. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
create_object error
After submitting a form using a generic view I get this error: Request Method: POST [...] Exception Type: ValueError Exception Value:incomplete format Exception Location: /usr/lib/python2.3/site-packages/django/views/generic/create_update.py in create_object, line 43 It seems an error with the format given to gettext(): request.user.message_set.create(message=gettext("The %(verbose_name)s was created successfully.") % {"verbose_name": model._meta.verbose_name}) Is that a bug or a feature? I checked that model._meta.verbose_name has the correct value then i'm a bit lost here. I'm working with a svn copy of revision 4926 (today). Thanks in advance. -- Marcelo Ramos Fedora Core 6 | 2.6.19 Socio UYLUG Nro 125 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---