Nick Coghlan writes:
It would actually be interesting to see just how far someone could get [on translating tracebacks] purely with sys.excepthook.
It would be subject to some fairly significant limitations (particularly when it comes to reparsing strings with interpolated values), but the traceback parsing and comparison code in doctest may offer a good starting point.
Actually, it shouldn't be too hard to handle the interpolations. In fact the language to be parsed is probably mostly pretty simple, and can be automatically translated to BNF or whatever input your favorite parsing library wants from the .pot file. The generated grammar probably would be on the order of the size of the .pot file, no? It could be stored with the .mos as a "pseudo-translation".