HomePhabricator

i18n.input prompt fallback

Description

i18n.input prompt fallback

pywikibot depends on four i18n messages that are only included
in git sub-module scripts/i18n, which is not packaged with pywikibot
in setup.py. Three uses of i18n messages are in pagegenerators.py, and
one is in Page for cosmetic_changes, however the code where the
cosmetic_changes i18n message occurs is already disabled when packaged
without scripts. The pagegenerators uses are all via i18n.input.

Instead of raising exception ImportError when the i18n git submodule
is not available, or packaging scripts and scripts.i18n for the sake
of the three pagegenerators i18n messages:

  • detect missing message package and raise custom exception TranslationError
  • add a fallback prompt to i18n.input, used by pagegenerators

Bug: 66897
Change-Id: I12518189126d8f929d30ab18bf8597a288d28891