mirror of
https://github.com/django/django.git
synced 2025-11-17 18:48:15 +00:00
Refs #28877 -- Eased ordinal translations for languages like French.
This commit is contained in:
parent
340e4f832e
commit
94cc804040
4 changed files with 12 additions and 3 deletions
Binary file not shown.
|
|
@ -23,6 +23,12 @@ msgstr ""
|
|||
msgid "Humanize"
|
||||
msgstr "Humanisation"
|
||||
|
||||
#. Translators: Ordinal format when value is 1.
|
||||
#: contrib/humanize/templatetags/humanize.py:37
|
||||
msgctxt "ordinal is 1"
|
||||
msgid "{}st"
|
||||
msgstr "{}<sup>er</sup>"
|
||||
|
||||
#. Translators: Ordinal format for 11 (11th), 12 (12th), and 13 (13th).
|
||||
msgctxt "ordinal 11, 12, 13"
|
||||
msgid "{}th"
|
||||
|
|
@ -36,7 +42,7 @@ msgstr "{}<sup>e</sup>"
|
|||
#. Translators: Ordinal format when value ends with 1, e.g. 81st, except 11.
|
||||
msgctxt "ordinal 1"
|
||||
msgid "{}st"
|
||||
msgstr "{}<sup>er</sup>"
|
||||
msgstr "{}<sup>e</sup>"
|
||||
|
||||
#. Translators: Ordinal format when value ends with 2, e.g. 82nd, except 12.
|
||||
msgctxt "ordinal 2"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@ def ordinal(value):
|
|||
return value
|
||||
if value < 0:
|
||||
return str(value)
|
||||
if value % 100 in (11, 12, 13):
|
||||
if value == 1:
|
||||
# Translators: Ordinal format when value is 1 (1st).
|
||||
value = pgettext("ordinal is 1", "{}st").format(value)
|
||||
elif 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:
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class HumanizeTests(SimpleTestCase):
|
|||
"11<sup>e</sup>",
|
||||
"12<sup>e</sup>",
|
||||
"13<sup>e</sup>",
|
||||
"101<sup>er</sup>",
|
||||
"101<sup>e</sup>",
|
||||
"102<sup>e</sup>",
|
||||
"103<sup>e</sup>",
|
||||
"111<sup>e</sup>",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue