summaryrefslogtreecommitdiffstats
path: root/Lib/gettext.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-25 18:48:59 (GMT)
committerGitHub <noreply@github.com>2023-07-25 18:48:59 (GMT)
commit11d86c5c339abd52d1ab5ce0af4d25c44898d046 (patch)
tree3229a81d0b2b8f7f885185f0eaa731b913dd5184 /Lib/gettext.py
parent313284aa423252ebd5d4e761220e0f4fdeac626d (diff)
downloadcpython-11d86c5c339abd52d1ab5ce0af4d25c44898d046.zip
cpython-11d86c5c339abd52d1ab5ce0af4d25c44898d046.tar.gz
cpython-11d86c5c339abd52d1ab5ce0af4d25c44898d046.tar.bz2
[3.12] gh-62519: Make pgettext search plurals when translation is not found (GH-107118) (GH-107134)
(cherry picked from commit b3c34e55c053846beb35f5e4253ef237b3494bd0) Co-authored-by: Tomas R <tomas.roun8@gmail.com> Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/gettext.py')
-rw-r--r--Lib/gettext.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/gettext.py b/Lib/gettext.py
index cc938e40..b72b15f 100644
--- a/Lib/gettext.py
+++ b/Lib/gettext.py
@@ -446,10 +446,12 @@ class GNUTranslations(NullTranslations):
missing = object()
tmsg = self._catalog.get(ctxt_msg_id, missing)
if tmsg is missing:
- if self._fallback:
- return self._fallback.pgettext(context, message)
- return message
- return tmsg
+ tmsg = self._catalog.get((ctxt_msg_id, self.plural(1)), missing)
+ if tmsg is not missing:
+ return tmsg
+ if self._fallback:
+ return self._fallback.pgettext(context, message)
+ return message
def npgettext(self, context, msgid1, msgid2, n):
ctxt_msg_id = self.CONTEXT % (context, msgid1)