@@ -674,7 +674,14 @@ def process_audit_events(app, doctree, fromdocname):
674674 node .replace_self (table )
675675
676676
677- def patch_pairindextypes (app ) -> None :
677+ def patch_pairindextypes (app , _env ) -> None :
678+ """Remove all entries from ``pairindextypes`` before writing POT files.
679+
680+ We want to run this just before writing output files, as the check to
681+ circumvent is in ``I18nBuilder.write_doc()``.
682+ As such, we link this to ``env-check-consistency``, even though it has
683+ nothing to do with the environment consistency check.
684+ """
678685 if app .builder .name != 'gettext' :
679686 return
680687
@@ -688,14 +695,7 @@ def patch_pairindextypes(app) -> None:
688695 # the Sphinx-translated pairindextypes values. As we intend to move
689696 # away from this, we need Sphinx to believe that these values don't
690697 # exist, by deleting them when using the gettext builder.
691-
692- pairindextypes .pop ('module' , None )
693- pairindextypes .pop ('keyword' , None )
694- pairindextypes .pop ('operator' , None )
695- pairindextypes .pop ('object' , None )
696- pairindextypes .pop ('exception' , None )
697- pairindextypes .pop ('statement' , None )
698- pairindextypes .pop ('builtin' , None )
698+ pairindextypes .clear ()
699699
700700
701701def setup (app ):
@@ -719,7 +719,7 @@ def setup(app):
719719 app .add_directive_to_domain ('py' , 'awaitablemethod' , PyAwaitableMethod )
720720 app .add_directive_to_domain ('py' , 'abstractmethod' , PyAbstractMethod )
721721 app .add_directive ('miscnews' , MiscNews )
722- app .connect ('builder-inited ' , patch_pairindextypes )
722+ app .connect ('env-check-consistency ' , patch_pairindextypes )
723723 app .connect ('doctree-resolved' , process_audit_events )
724724 app .connect ('env-merge-info' , audit_events_merge )
725725 app .connect ('env-purge-doc' , audit_events_purge )
0 commit comments