#23196: Don't translate empty string as gettext metadata
--------------------------------------+--------------------
     Reporter:  nedbatchelder         |      Owner:  nobody
         Type:  Uncategorized         |     Status:  new
    Component:  Internationalization  |    Version:  master
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 (this is very similar to #11363)

 If you pass an empty string to django.utils.translation.ugettext, it
 returns the metadata from the translations file.  I know that this is the
 GNU gettext behavior, but honestly, I can't imagine a use for it.

 This is a problem when you have a string which can be overridden by a
 user, but usually is not, and the default value for the string is
 translated.  If the user enters an empty string, ugettext returns the
 metadata. Surprise!

 Of course, an option is to check the string before calling ugettext, but
 this is an easy step to overlook, especially because it is conceptually
 unnecessary.  It would be great if Django's wrappers for gettext would do
 the obvious thing and return an empty string if asked to translate an
 empty string.

 For a low-level library, it could make sense to get the metadata with
 gettext(""), but how would you reasonably use that in Django?  And ffs,
 why didn't they just make a function to get the metadata if people wanted
 metadata? :)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23196>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.9fe332ee59b739afddf3d67aa3ed7697%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to