diff --git a/django/contrib/humanize/locale/fr/LC_MESSAGES/django.mo b/django/contrib/humanize/locale/fr/LC_MESSAGES/django.mo index 6807322294..fdafcad708 100644 Binary files a/django/contrib/humanize/locale/fr/LC_MESSAGES/django.mo and b/django/contrib/humanize/locale/fr/LC_MESSAGES/django.mo differ diff --git a/django/contrib/humanize/locale/fr/LC_MESSAGES/django.po b/django/contrib/humanize/locale/fr/LC_MESSAGES/django.po index 142c6adbfa..74b863b4ce 100644 --- a/django/contrib/humanize/locale/fr/LC_MESSAGES/django.po +++ b/django/contrib/humanize/locale/fr/LC_MESSAGES/django.po @@ -10,8 +10,8 @@ msgstr "" "Project-Id-Version: django\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-01-17 11:07+0100\n" -"PO-Revision-Date: 2017-09-19 16:40+0000\n" -"Last-Translator: Jannis Leidel \n" +"PO-Revision-Date: 2017-12-06 01:44+0800\n" +"Last-Translator: Tzu-ping Chung \n" "Language-Team: French (http://www.transifex.com/django/django/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -22,17 +22,49 @@ msgstr "" msgid "Humanize" msgstr "Humanisation" -msgid "th" -msgstr "e" +msgctxt "ordinal 11, 12, 13" +msgid "{}th" +msgstr "{}e" -msgid "st" -msgstr "er" +msgctxt "ordinal 0" +msgid "{}th" +msgstr "{}e" -msgid "nd" -msgstr "e" +msgctxt "ordinal 1" +msgid "{}st" +msgstr "{}er" -msgid "rd" -msgstr "e" +msgctxt "ordinal 2" +msgid "{}nd" +msgstr "{}e" + +msgctxt "ordinal 3" +msgid "{}rd" +msgstr "{}e" + +msgctxt "ordinal 4" +msgid "{}th" +msgstr "{}e" + +msgctxt "ordinal 5" +msgid "{}th" +msgstr "{}e" + +msgctxt "ordinal 6" +msgid "{}th" +msgstr "{}e" + +msgctxt "ordinal 7" +msgid "{}th" +msgstr "{}e" + +msgctxt "ordinal 8" +msgid "{}th" +msgstr "{}e" + +msgctxt "ordinal 9" +msgid "{}th" +msgstr "{}e" #, python-format msgid "%(value).1f million" diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index fa644fd3a1..7b99d78f1e 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/django/contrib/humanize/templatetags/humanize.py @@ -23,11 +23,35 @@ def ordinal(value): value = int(value) except (TypeError, ValueError): return value - suffixes = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'), _('th'), _('th'), _('th')) - if value % 100 in (11, 12, 13): # special case - return mark_safe("%d%s" % (value, suffixes[0])) + if value % 100 in (11, 12, 13): + # Translators: Ordinal format for 11 (11th), 12 (12th), and 13 (13th). + value = pgettext('ordinal 11, 12, 13', '{}th').format(value) + else: + templates = ( + # Translators: Ordinal format when value ends with 0, e.g. 80th. + pgettext('ordinal 0', '{}th'), + # Translators: Ordinal format when value ends with 1, e.g. 81st, except 11. + pgettext('ordinal 1', '{}st'), + # Translators: Ordinal format when value ends with 2, e.g. 82nd, except 12. + pgettext('ordinal 2', '{}nd'), + # Translators: Ordinal format when value ends with 3, e.g. 83th, except 13. + pgettext('ordinal 3', '{}rd'), + # Translators: Ordinal format when value ends with 4, e.g. 84th. + pgettext('ordinal 4', '{}th'), + # Translators: Ordinal format when value ends with 5, e.g. 85th. + pgettext('ordinal 5', '{}th'), + # Translators: Ordinal format when value ends with 6, e.g. 86th. + pgettext('ordinal 6', '{}th'), + # Translators: Ordinal format when value ends with 7, e.g. 87th. + pgettext('ordinal 7', '{}th'), + # Translators: Ordinal format when value ends with 8, e.g. 88th. + pgettext('ordinal 8', '{}th'), + # Translators: Ordinal format when value ends with 9, e.g. 89th. + pgettext('ordinal 9', '{}th'), + ) + value = templates[value % 10].format(value) # Mark value safe so i18n does not break with or see #19988 - return mark_safe("%d%s" % (value, suffixes[value % 10])) + return mark_safe(value) @register.filter(is_safe=True)