def trans(self, id, parameters=None, domain=None, locale=None):
if parameters is None:<EOL><INDENT>parameters = {}<EOL><DEDENT>assert isinstance(parameters, dict)<EOL>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>msg = self.get_catalogue(locale).get(id, domain)<EOL>return self.format(msg, parameters)<EOL>
Translates the given message.

@type id: str
@param id: The message id

@type parameters: dict
@param parameters: A dict of parameters for the message

@type domain: str
@param domain: The domain for the message or null to use the default

@type locale: str
@param locale: The locale or null to use the default

@rtype: str
@return: Translated message