This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import click | |
# (1) My gettext helpers are _() and _n(), replace them by yours if necessary. | |
# (2) I've used the exact same messages in translations, you can adapt them. | |
def translate_click_exception(e): | |
""" | |
Analyse a click exception, translate its message using gettext | |
and re-raise it in current language. |