MCPcopy Index your code
hub / github.com/python/cpython / pgettext

Method pgettext

Lib/gettext.py:462–472  ·  view source on GitHub ↗
(self, context, message)

Source from the content-addressed store, hash-verified

460 return tmsg
461
462 def pgettext(self, context, message):
463 ctxt_msg_id = self.CONTEXT % (context, message)
464 missing = object()
465 tmsg = self._catalog.get(ctxt_msg_id, missing)
466 if tmsg is missing:
467 tmsg = self._catalog.get((ctxt_msg_id, self.plural(1)), missing)
468 if tmsg is not missing:
469 return tmsg
470 if self._fallback:
471 return self._fallback.pgettext(context, message)
472 return message
473
474 def npgettext(self, context, msgid1, msgid2, n):
475 ctxt_msg_id = self.CONTEXT % (context, msgid1)

Callers 4

test_translationsMethod · 0.95
pgettextMethod · 0.45
dpgettextFunction · 0.45

Calls 2

getMethod · 0.45
pluralMethod · 0.45

Tested by 2

test_translationsMethod · 0.76