def _translate_errors(self, errors, translate):
for prop in errors:<EOL><INDENT>prop_errors = errors[prop]<EOL>if type(prop_errors) is list:<EOL><INDENT>for index, error in enumerate(prop_errors):<EOL><INDENT>message = translate(error.message)<EOL>message = self.format_error(message, error.kwargs)<EOL>errors[prop][index] = message<EOL><DEDENT><DEDENT>if type(prop_errors) is dict and '<STR_LIT>' in prop_errors:<EOL><INDENT>for index, error in enumerate(prop_errors['<STR_LIT>']):<EOL><INDENT>message = translate(error.message)<EOL>message = self.format_error(message, error.kwargs)<EOL>errors[prop]['<STR_LIT>'][index] = message<EOL><DEDENT><DEDENT>if type(prop_errors) is dict and '<STR_LIT>' in prop_errors:<EOL><INDENT>errors[prop]['<STR_LIT>'] = self._translate_errors(<EOL>prop_errors['<STR_LIT>'],<EOL>translate<EOL>)<EOL><DEDENT>if type(prop_errors) is dict and '<STR_LIT>' in prop_errors:<EOL><INDENT>translated = dict()<EOL>for index, result in prop_errors['<STR_LIT>'].items():<EOL><INDENT>translated[index] = self._translate_errors(<EOL>result.errors,<EOL>translate<EOL>)<EOL>errors[prop]['<STR_LIT>'] = translated<EOL><DEDENT><DEDENT><DEDENT>return errors<EOL>
Recursively apply translate callback to each error message