mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-62519: Make pgettext search plurals when translation is not found (#107118)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
b273837fea
commit
b3c34e55c0
3 changed files with 12 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue