diff options
| author | glts <676c7473@gmail.com> | 2013-11-13 20:16:39 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-11-15 15:32:46 +0100 |
| commit | 7e0ebd74c107e3267b1df438ed7f061f8be5cf05 (patch) | |
| tree | 89e55c7c53fdda121266a79ce9ec04a707d41951 | |
| parent | 115fd140ab9522e6ac688f389db681d79562df74 (diff) | |
Fixed #21415 -- Replaced escape sequence by literal non-breaking space
Unfortunately, escape sequences (\x.. or \u....) do not fit well
with the gettext toolchain. Falling back to using literal char,
even if visibility is not ideal.
| -rw-r--r-- | django/contrib/humanize/templatetags/humanize.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index e33631a15d..993b72866b 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/django/contrib/humanize/templatetags/humanize.py @@ -1,4 +1,6 @@ +# -*- encoding: utf-8 -*- from __future__ import unicode_literals + import re from datetime import date, datetime from decimal import Decimal @@ -202,20 +204,23 @@ def naturaltime(value): return _('now') elif delta.seconds < 60: return ungettext( - # Translators: \\u00a0 is non-breaking space - 'a second ago', '%(count)s\u00a0seconds ago', delta.seconds + # Translators: please keep a non-breaking space (U+00A0) + # between count and time unit. + 'a second ago', '%(count)s seconds ago', delta.seconds ) % {'count': delta.seconds} elif delta.seconds // 60 < 60: count = delta.seconds // 60 return ungettext( - # Translators: \\u00a0 is non-breaking space - 'a minute ago', '%(count)s\u00a0minutes ago', count + # Translators: please keep a non-breaking space (U+00A0) + # between count and time unit. + 'a minute ago', '%(count)s minutes ago', count ) % {'count': count} else: count = delta.seconds // 60 // 60 return ungettext( - # Translators: \\u00a0 is non-breaking space - 'an hour ago', '%(count)s\u00a0hours ago', count + # Translators: please keep a non-breaking space (U+00A0) + # between count and time unit. + 'an hour ago', '%(count)s hours ago', count ) % {'count': count} else: delta = value - now @@ -227,18 +232,21 @@ def naturaltime(value): return _('now') elif delta.seconds < 60: return ungettext( - # Translators: \\u00a0 is non-breaking space - 'a second from now', '%(count)s\u00a0seconds from now', delta.seconds + # Translators: please keep a non-breaking space (U+00A0) + # between count and time unit. + 'a second from now', '%(count)s seconds from now', delta.seconds ) % {'count': delta.seconds} elif delta.seconds // 60 < 60: count = delta.seconds // 60 return ungettext( - # Translators: \\u00a0 is non-breaking space - 'a minute from now', '%(count)s\u00a0minutes from now', count + # Translators: please keep a non-breaking space (U+00A0) + # between count and time unit. + 'a minute from now', '%(count)s minutes from now', count ) % {'count': count} else: count = delta.seconds // 60 // 60 return ungettext( - # Translators: \\u00a0 is non-breaking space - 'an hour from now', '%(count)s\u00a0hours from now', count + # Translators: please keep a non-breaking space (U+00A0) + # between count and time unit. + 'an hour from now', '%(count)s hours from now', count ) % {'count': count} |
