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

Method npgettext

Lib/gettext.py:474–485  ·  view source on GitHub ↗
(self, context, msgid1, msgid2, n)

Source from the content-addressed store, hash-verified

472 return message
473
474 def npgettext(self, context, msgid1, msgid2, n):
475 ctxt_msg_id = self.CONTEXT % (context, msgid1)
476 try:
477 tmsg = self._catalog[ctxt_msg_id, self.plural(n)]
478 except KeyError:
479 if self._fallback:
480 return self._fallback.npgettext(context, msgid1, msgid2, n)
481 if n == 1:
482 tmsg = msgid1
483 else:
484 tmsg = msgid2
485 return tmsg
486
487
488# Locate a .mo file using the gettext strategy

Callers 4

test_translationsMethod · 0.95
npgettextMethod · 0.45
dnpgettextFunction · 0.45

Calls 1

pluralMethod · 0.45

Tested by 2

test_translationsMethod · 0.76