A very simple solution : use regexes to parse the error message and then translate it :
```
const reg = new Regex(/^%([\w+]) format: a real number is required, not ([\w]+)$/);
if ( res = reg.exec(msg) )
return `Error: ${res[0]} foo ${res[1]}`;
// do other regex for other error messages.
```
We could also modify Brython.
Maybe it could be possible to replace :
```
if(! $B.$isinstance(s, [_b_.int, _b_.float]) ){
var type = flags.conversion_type
throw _b_.TypeError.$factory(`%${type} format: a real number ` +
`is required, not ${$B.class_name(s)}`)
}
```
By :
```
function raw(...args) { return args; }
_b_.assertError( $B.$isinstance(s, [_b_.int, _b_.float]), _b_.TypeError, raw`%${flags.conversion_type} format: a real number is required, not ${$B.class_name(s)}` )
```
Then you could override `assertError`to build your own error message.
Maybe a message/error factory could be useful:
```
_b_.errorsMsg = {
formatRealRequired : (format, s) => _b_.TypeError.$factory(`%${format} format: a real number is required, not ${$B.class_name(s)}`)
}
_b_.assertError( $B.$isinstance(s, [_b_.int, _b_.float]), _b_.errorsMsg.formatRealRequired(flags.conversion_type, s) );
```
But that would require lot of changes to the Brython code.