From e4430f22c8e3d29ce5d9d0263fba57121938d06d Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 18 Jan 2021 19:03:37 +0100 Subject: [PATCH] Fixed #31937 -- Eased translation of time strings in some languages. --- django/conf/locale/cs/LC_MESSAGES/django.mo | Bin 29027 -> 29207 bytes django/conf/locale/cs/LC_MESSAGES/django.po | 74 ++++----- django/conf/locale/en/LC_MESSAGES/django.po | 26 ++-- .../humanize/locale/cs/LC_MESSAGES/django.mo | Bin 5119 -> 5479 bytes .../humanize/locale/cs/LC_MESSAGES/django.po | 144 +++++++++--------- .../humanize/locale/en/LC_MESSAGES/django.po | 50 +++--- .../contrib/humanize/templatetags/humanize.py | 24 +-- django/utils/timesince.py | 18 +-- tests/utils_tests/test_timesince.py | 7 +- 9 files changed, 174 insertions(+), 169 deletions(-) diff --git a/django/conf/locale/cs/LC_MESSAGES/django.mo b/django/conf/locale/cs/LC_MESSAGES/django.mo index 121d7d4a2b4e396b6b214eec181c3f446a865c68..addcb5054dc5f32fe6207e4a6737f2dc534a020b 100644 GIT binary patch delta 6177 zcmZwK2~?G39>?+LBD-rLyK=!45EacGGZ)N_azV{pNM)rgF*_ z6YZoPb8N9Doy?rFvehi6oQ_N5R9ZQcrX8o5@9(~UfjZ;i@_GKx^Ssagycdrh^*wyt zxBB`(l5;LA&AAjDhWxmh{OW+qEdOEiPnLfGBPjpI{J}hHUNFP_&Sg+98pALLeb@uT zv8Ue!Tx$}2twKJ=5Rb%YoPcd{8mhx`jKnI8!^Nn2_nK?0{87A={PoxpU$Fc=7)$&X zM&ZZ)fOG9hd`<>~c0XWeY@6;?=!+^JjOw@$Ljyt$v>eq?4d&o7i|bMKx1t9AJYIsY zpjP}{MosP;cbt$d(?L>`F~sF`GRa&8fJ#fR{5tiyhnIky_O;0C;sWm=C%aWLN1#knE) zI$nXkOy?5uO7mLO%2i@2-ikC8aBD4N7ixwLsJ%O7v8JQ^_Nb-HMm0Pfbx5aU0@k7G ztwPQCDV&Zk;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LBeKIPNTFk)}s0{qc>Ibkh z^;4LJZMhmsbph)A;iy1nU^Xs8UB7!V6Q2uH&?@38+1t zhFVw!#^XOwU%*4CE%*qt@pIIBt)~0K*Bc3? za0Op2ylRGDU@txbns5Lrg(FZ4nu9tk^{5Q3Km~R)_Q4lWnQB5U=zLIT|9_^S0b{Q8 zD^5UlNI`u%v#q_r?1$<<)EtYNxZIvsT6-;OOBzuNT8mofdQ|^S_&44E9Taq`YiIh2 ze`~HbZ!`ahDfHWb`Y=6>x;?whJ;=>+uUS2r1CT*I2i1Qt_QPS=9k0W1GKEbPvT!$Q zfTNg(T`K$`8II~V3w3XoqHe`4s7$QKOnexXxtCA@9kA!`qcU&;wZ%=yg>m0hu>U$N zV`pv1ve!+b2MWc4^3|9~6K-c|mvy@;CNWlYCIn22XlfyB=7DbGa((i^q# z(R0H7P)wvDiiT;Z1m5NttxG-@FeF^Uh<6g)L#ejG^B!tBd>HwY?oQz>99Zvv#NLM$)X(8koYcVi!B?;d za~AsRIAvj1f7)-Pp_B(ZQK$Y3t9M@HS6s0uG9z(Ps4%iM@!F{JP$WO;?WiOd`6;P5 zs&gn(oLm@lgtuH|e)929Tx48ITBucIeo7k0DRN^Me;l5>a+(Zb0YTSZT>R4{-}RSF^>OA zLXrB8^`ZF4(T+WmHu2zBG_Jx4cmXd7MKaUw2vtS4r`;5Ck&^TtA-AJCeQzl8MrL}= z-0ZoP%Uxc;Vp-F$*E)TTnvbZvEYty*Nzu)Ml57)dUU ztSQUh5tnr)KQgIoV3_Hu>(zN~y`Q{(&sJac)-=qWUtg(~pcM4^zmgsX3ktdgrJ!3- z`rpH#u=l>jd$!K`MX}0<\n" "Language-Team: Czech (http://www.transifex.com/django/django/language/cs/)\n" @@ -1143,52 +1143,52 @@ msgid ", " msgstr ", " #, python-format -msgid "%d year" -msgid_plural "%d years" -msgstr[0] "%d rok" -msgstr[1] "%d roky" -msgstr[2] "%d roku" -msgstr[3] "%d let" +msgid "%(num)d year" +msgid_plural "%(num)d years" +msgstr[0] "%(num)d rok" +msgstr[1] "%(num)d roky" +msgstr[2] "%(num)d roku" +msgstr[3] "%(num)d let" #, python-format -msgid "%d month" -msgid_plural "%d months" -msgstr[0] "%d měsíc" -msgstr[1] "%d měsíce" -msgstr[2] "%d měsíců" -msgstr[3] "%d měsíců" +msgid "%(num)d month" +msgid_plural "%(num)d months" +msgstr[0] "%(num)d měsíc" +msgstr[1] "%(num)d měsíce" +msgstr[2] "%(num)d měsíců" +msgstr[3] "%(num)d měsíců" #, python-format -msgid "%d week" -msgid_plural "%d weeks" -msgstr[0] "%d týden" -msgstr[1] "%d týdny" -msgstr[2] "%d týdne" -msgstr[3] "%d týdnů" +msgid "%(num)d week" +msgid_plural "%(num)d weeks" +msgstr[0] "%(num)d týden" +msgstr[1] "%(num)d týdny" +msgstr[2] "%(num)d týdne" +msgstr[3] "%(num)d týdnů" #, python-format -msgid "%d day" -msgid_plural "%d days" -msgstr[0] "%d den" -msgstr[1] "%d dny" -msgstr[2] "%d dní" -msgstr[3] "%d dní" +msgid "%(num)d day" +msgid_plural "%(num)d days" +msgstr[0] "%(num)d den" +msgstr[1] "%(num)d dny" +msgstr[2] "%(num)d dní" +msgstr[3] "%(num)d dní" #, python-format -msgid "%d hour" -msgid_plural "%d hours" -msgstr[0] "%d hodina" -msgstr[1] "%d hodiny" -msgstr[2] "%d hodiny" -msgstr[3] "%d hodin" +msgid "%(num)d hour" +msgid_plural "%(num)d hours" +msgstr[0] "%(num)d hodina" +msgstr[1] "%(num)d hodiny" +msgstr[2] "%(num)d hodiny" +msgstr[3] "%(num)d hodin" #, python-format -msgid "%d minute" -msgid_plural "%d minutes" -msgstr[0] "%d minuta" -msgstr[1] "%d minuty" -msgstr[2] "%d minut" -msgstr[3] "%d minut" +msgid "%(num)d minute" +msgid_plural "%(num)d minutes" +msgstr[0] "%(num)d minuta" +msgstr[1] "%(num)d minuty" +msgstr[2] "%(num)d minut" +msgstr[3] "%(num)d minut" msgid "Forbidden" msgstr "Nepřístupné (Forbidden)" diff --git a/django/conf/locale/en/LC_MESSAGES/django.po b/django/conf/locale/en/LC_MESSAGES/django.po index e3d7690c86..5a96b740c7 100644 --- a/django/conf/locale/en/LC_MESSAGES/django.po +++ b/django/conf/locale/en/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Django\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-15 09:00+0100\n" +"POT-Creation-Date: 2021-04-10 16:05+0200\n" "PO-Revision-Date: 2010-05-13 15:35+0200\n" "Last-Translator: Django team\n" "Language-Team: English \n" @@ -1364,43 +1364,43 @@ msgstr "" #: utils/timesince.py:9 #, python-format -msgid "%d year" -msgid_plural "%d years" +msgid "%(num)d year" +msgid_plural "%(num)d years" msgstr[0] "" msgstr[1] "" #: utils/timesince.py:10 #, python-format -msgid "%d month" -msgid_plural "%d months" +msgid "%(num)d month" +msgid_plural "%(num)d months" msgstr[0] "" msgstr[1] "" #: utils/timesince.py:11 #, python-format -msgid "%d week" -msgid_plural "%d weeks" +msgid "%(num)d week" +msgid_plural "%(num)d weeks" msgstr[0] "" msgstr[1] "" #: utils/timesince.py:12 #, python-format -msgid "%d day" -msgid_plural "%d days" +msgid "%(num)d day" +msgid_plural "%(num)d days" msgstr[0] "" msgstr[1] "" #: utils/timesince.py:13 #, python-format -msgid "%d hour" -msgid_plural "%d hours" +msgid "%(num)d hour" +msgid_plural "%(num)d hours" msgstr[0] "" msgstr[1] "" #: utils/timesince.py:14 #, python-format -msgid "%d minute" -msgid_plural "%d minutes" +msgid "%(num)d minute" +msgid_plural "%(num)d minutes" msgstr[0] "" msgstr[1] "" diff --git a/django/contrib/humanize/locale/cs/LC_MESSAGES/django.mo b/django/contrib/humanize/locale/cs/LC_MESSAGES/django.mo index 4951d85b713911802f4444ca7c9d6fbfa24361a4..4b4622290b434b325e02cecbf50714eeb80ba479 100644 GIT binary patch literal 5479 zcma);TWlLe6ov-~6b$8lzfLJ>6WX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contrib/humanize/templatetags/humanize.py:205 #, python-format msgctxt "naturaltime-past" -msgid "%d year" -msgid_plural "%d years" +msgid "%(num)d year" +msgid_plural "%(num)d years" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:206 #, python-format msgctxt "naturaltime-past" -msgid "%d month" -msgid_plural "%d months" +msgid "%(num)d month" +msgid_plural "%(num)d months" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:207 #, python-format msgctxt "naturaltime-past" -msgid "%d week" -msgid_plural "%d weeks" +msgid "%(num)d week" +msgid_plural "%(num)d weeks" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:208 #, python-format msgctxt "naturaltime-past" -msgid "%d day" -msgid_plural "%d days" +msgid "%(num)d day" +msgid_plural "%(num)d days" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:209 #, python-format msgctxt "naturaltime-past" -msgid "%d hour" -msgid_plural "%d hours" +msgid "%(num)d hour" +msgid_plural "%(num)d hours" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:210 #, python-format msgctxt "naturaltime-past" -msgid "%d minute" -msgid_plural "%d minutes" +msgid "%(num)d minute" +msgid_plural "%(num)d minutes" msgstr[0] "" msgstr[1] "" @@ -332,47 +332,47 @@ msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:214 #, python-format msgctxt "naturaltime-future" -msgid "%d year" -msgid_plural "%d years" +msgid "%(num)d year" +msgid_plural "%(num)d years" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:215 #, python-format msgctxt "naturaltime-future" -msgid "%d month" -msgid_plural "%d months" +msgid "%(num)d month" +msgid_plural "%(num)d months" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:216 #, python-format msgctxt "naturaltime-future" -msgid "%d week" -msgid_plural "%d weeks" +msgid "%(num)d week" +msgid_plural "%(num)d weeks" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:217 #, python-format msgctxt "naturaltime-future" -msgid "%d day" -msgid_plural "%d days" +msgid "%(num)d day" +msgid_plural "%(num)d days" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:218 #, python-format msgctxt "naturaltime-future" -msgid "%d hour" -msgid_plural "%d hours" +msgid "%(num)d hour" +msgid_plural "%(num)d hours" msgstr[0] "" msgstr[1] "" #: contrib/humanize/templatetags/humanize.py:219 #, python-format msgctxt "naturaltime-future" -msgid "%d minute" -msgid_plural "%d minutes" +msgid "%(num)d minute" +msgid_plural "%(num)d minutes" msgstr[0] "" msgstr[1] "" diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index 753a0d9fe1..095a053fa1 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/django/contrib/humanize/templatetags/humanize.py @@ -202,21 +202,21 @@ class NaturalTimeFormatter: } past_substrings = { # Translators: 'naturaltime-past' strings will be included in '%(delta)s ago' - 'year': npgettext_lazy('naturaltime-past', '%d year', '%d years'), - 'month': npgettext_lazy('naturaltime-past', '%d month', '%d months'), - 'week': npgettext_lazy('naturaltime-past', '%d week', '%d weeks'), - 'day': npgettext_lazy('naturaltime-past', '%d day', '%d days'), - 'hour': npgettext_lazy('naturaltime-past', '%d hour', '%d hours'), - 'minute': npgettext_lazy('naturaltime-past', '%d minute', '%d minutes'), + 'year': npgettext_lazy('naturaltime-past', '%(num)d year', '%(num)d years', 'num'), + 'month': npgettext_lazy('naturaltime-past', '%(num)d month', '%(num)d months', 'num'), + 'week': npgettext_lazy('naturaltime-past', '%(num)d week', '%(num)d weeks', 'num'), + 'day': npgettext_lazy('naturaltime-past', '%(num)d day', '%(num)d days', 'num'), + 'hour': npgettext_lazy('naturaltime-past', '%(num)d hour', '%(num)d hours', 'num'), + 'minute': npgettext_lazy('naturaltime-past', '%(num)d minute', '%(num)d minutes', 'num'), } future_substrings = { # Translators: 'naturaltime-future' strings will be included in '%(delta)s from now' - 'year': npgettext_lazy('naturaltime-future', '%d year', '%d years'), - 'month': npgettext_lazy('naturaltime-future', '%d month', '%d months'), - 'week': npgettext_lazy('naturaltime-future', '%d week', '%d weeks'), - 'day': npgettext_lazy('naturaltime-future', '%d day', '%d days'), - 'hour': npgettext_lazy('naturaltime-future', '%d hour', '%d hours'), - 'minute': npgettext_lazy('naturaltime-future', '%d minute', '%d minutes'), + 'year': npgettext_lazy('naturaltime-future', '%(num)d year', '%(num)d years', 'num'), + 'month': npgettext_lazy('naturaltime-future', '%(num)d month', '%(num)d months', 'num'), + 'week': npgettext_lazy('naturaltime-future', '%(num)d week', '%(num)d weeks', 'num'), + 'day': npgettext_lazy('naturaltime-future', '%(num)d day', '%(num)d days', 'num'), + 'hour': npgettext_lazy('naturaltime-future', '%(num)d hour', '%(num)d hours', 'num'), + 'minute': npgettext_lazy('naturaltime-future', '%(num)d minute', '%(num)d minutes', 'num'), } @classmethod diff --git a/django/utils/timesince.py b/django/utils/timesince.py index a9e6b61959..157dcb72c2 100644 --- a/django/utils/timesince.py +++ b/django/utils/timesince.py @@ -6,12 +6,12 @@ from django.utils.timezone import is_aware, utc from django.utils.translation import gettext, ngettext_lazy TIME_STRINGS = { - 'year': ngettext_lazy('%d year', '%d years'), - 'month': ngettext_lazy('%d month', '%d months'), - 'week': ngettext_lazy('%d week', '%d weeks'), - 'day': ngettext_lazy('%d day', '%d days'), - 'hour': ngettext_lazy('%d hour', '%d hours'), - 'minute': ngettext_lazy('%d minute', '%d minutes'), + 'year': ngettext_lazy('%(num)d year', '%(num)d years', 'num'), + 'month': ngettext_lazy('%(num)d month', '%(num)d months', 'num'), + 'week': ngettext_lazy('%(num)d week', '%(num)d weeks', 'num'), + 'day': ngettext_lazy('%(num)d day', '%(num)d days', 'num'), + 'hour': ngettext_lazy('%(num)d hour', '%(num)d hours', 'num'), + 'minute': ngettext_lazy('%(num)d minute', '%(num)d minutes', 'num'), } TIMESINCE_CHUNKS = ( @@ -73,13 +73,13 @@ def timesince(d, now=None, reversed=False, time_strings=None, depth=2): since = delta.days * 24 * 60 * 60 + delta.seconds if since <= 0: # d is in the future compared to now, stop processing. - return avoid_wrapping(time_strings['minute'] % 0) + return avoid_wrapping(time_strings['minute'] % {'num': 0}) for i, (seconds, name) in enumerate(TIMESINCE_CHUNKS): count = since // seconds if count != 0: break else: - return avoid_wrapping(time_strings['minute'] % 0) + return avoid_wrapping(time_strings['minute'] % {'num': 0}) result = [] current_depth = 0 while i < len(TIMESINCE_CHUNKS) and current_depth < depth: @@ -87,7 +87,7 @@ def timesince(d, now=None, reversed=False, time_strings=None, depth=2): count = since // seconds if count == 0: break - result.append(avoid_wrapping(time_strings[name] % count)) + result.append(avoid_wrapping(time_strings[name] % {'num': count})) since -= seconds * count current_depth += 1 i += 1 diff --git a/tests/utils_tests/test_timesince.py b/tests/utils_tests/test_timesince.py index d30bf00ae9..d080f1b1c5 100644 --- a/tests/utils_tests/test_timesince.py +++ b/tests/utils_tests/test_timesince.py @@ -77,7 +77,12 @@ class TimesinceTests(TestCase): def test_second_before_equal_first_humanize_time_strings(self): time_strings = { - 'minute': npgettext_lazy('naturaltime-future', '%d minute', '%d minutes'), + 'minute': npgettext_lazy( + 'naturaltime-future', + '%(num)d minute', + '%(num)d minutes', + 'num', + ), } with translation.override('cs'): for now in [self.t, self.t - self.onemicrosecond, self.t - self.oneday]: