summaryrefslogtreecommitdiffstats
path: root/Lib/gettext.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-23 12:29:08 (GMT)
committerGitHub <noreply@github.com>2023-07-23 12:29:08 (GMT)
commitbd72fb19ef1a01fde067109288ecacc62121f0ae (patch)
treee0c96d7cf1c639b7dfaa50442291670889f36546 /Lib/gettext.py
parentaf95a1da465da82740541bf011a324fefaf53713 (diff)
downloadcpython-bd72fb19ef1a01fde067109288ecacc62121f0ae.zip
cpython-bd72fb19ef1a01fde067109288ecacc62121f0ae.tar.gz
cpython-bd72fb19ef1a01fde067109288ecacc62121f0ae.tar.bz2
[3.12] bpo-18319: gettext() can retrieve a message even if a plural form exists (GH-19869) (#107108)
(cherry picked from commit 54632528eeba841e4a8cc95ecbd84c9aca8eef57) Co-authored-by: Gilles Bassière <gbassiere@gmail.com>
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 6c5ec4e..cc938e40 100644
--- a/Lib/gettext.py
+++ b/Lib/gettext.py
@@ -422,10 +422,12 @@ class GNUTranslations(NullTranslations):
missing = object()
tmsg = self._catalog.get(message, missing)
if tmsg is missing:
- if self._fallback:
- return self._fallback.gettext(message)
- return message
- return tmsg
+ tmsg = self._catalog.get((message, self.plural(1)), missing)
+ if tmsg is not missing:
+ return tmsg
+ if self._fallback:
+ return self._fallback.gettext(message)
+ return message
def ngettext(self, msgid1, msgid2, n):
try: