#21408: Fallback to timesince produces erroneous translations in naturaltime
-------------------------------------+-------------------------------------
     Reporter:  676c7473@…           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:                       |                  Version:  master
  Internationalization               |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  i18n l10n            |      Needs documentation:  0
  translation                        |  Patch needs improvement:  0
    Has patch:  0                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by 676c7473@…):

 I'm running into some difficulties with the code and the translations.
 Could it be that the .po files are out of sync with the code?

 in `humanize.py`, line 204, there are bits like this one:

 {{{
     return ungettext(
         # Translators: \\u00a0 is non-breaking space
         'a second ago', '%(count)s\u00a0seconds ago', delta.seconds
     ) % {'count': delta.seconds}
 }}}

 There is a corresponding entry in the "en" locale, but in the "de" locale
 it looks different:

 {{{
 #. Translators: \\u00a0 is non-breaking space
 #: templatetags/humanize.py:198
 #, python-format
 msgid "a second ago"
 msgid_plural "%(count)s\\u00a0seconds ago"
 msgstr[0] ""
 msgstr[1] ""
 }}}

 {{{
 #: templatetags/humanize.py:196
 #, python-format
 msgid "a second ago"
 msgid_plural "%(count)s seconds ago"
 msgstr[0] "vor einer Sekunde"
 msgstr[1] "vor %(count)s Sekunden"
 }}}

 I guess the translation is still found because the msgid is the same, but
 the German translation doesn't have the non-breaking space.

 Also, these gettext messages in `timesince.py`, line 24,

 {{{
     chunks = (
         (60 * 60 * 24 * 365, ungettext_lazy('%d year', '%d years')),
         (60 * 60 * 24 * 30, ungettext_lazy('%d month', '%d months')),
         ...
 }}}

 don't exist in the "de" translations. As far as I can tell, the msgid
 `"year"` will not match `"%d year"`.

 {{{
 #: utils/timesince.py:23
 #, python-format
 msgid "%d year"
 msgid_plural "%d years"
 msgstr[0] ""
 msgstr[1] ""
 }}}

 {{{
 #: utils/timesince.py:22
 msgid "year"
 msgid_plural "years"
 msgstr[0] "Jahr"
 msgstr[1] "Jahre"
 }}}

 I'm not sure what's happening here. I'll experiment some more, maybe
 things will become clearer soon. If you want to share some advice, please
 do! Thanks.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21408#comment:3>
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/076.dec29b449689160805d3091b87c645e7%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to