def trans(self, id, parameters=None, domain=None, locale=None):
if parameters is None:<EOL><INDENT>parameters = {}<EOL><DEDENT>if locale is None:<EOL><INDENT>locale = self.locale<EOL><DEDENT>else:<EOL><INDENT>self._assert_valid_locale(locale)<EOL><DEDENT>if domain is None:<EOL><INDENT>domain = '<STR_LIT>'<EOL><DEDENT>catalogue = self.get_catalogue(locale)<EOL>if not catalogue.has(id, domain):<EOL><INDENT>raise RuntimeError(<EOL>"<STR_LIT>".format(<EOL>id,<EOL>domain<EOL>)<EOL>)<EOL><DEDENT>msg = self.get_catalogue(locale).get(id, domain)<EOL>return self.format(msg, parameters)<EOL>
Throws RuntimeError whenever a message is missing