def load_messages(self, directory, catalogue):
if not os.path.isdir(directory):<EOL><INDENT>raise ValueError("<STR_LIT>".format(directory))<EOL><DEDENT>for format, loader in list(self.loaders.items()):<EOL><INDENT>extension = "<STR_LIT>".format(catalogue.locale, format)<EOL>files = find_files(directory, "<STR_LIT>".format(extension))<EOL>for file in files:<EOL><INDENT>domain = file.split("<STR_LIT:/>")[-<NUM_LIT:1>][:-<NUM_LIT:1> * len(extension) - <NUM_LIT:1>]<EOL>catalogue.add_catalogue(<EOL>loader.load(<EOL>file,<EOL>catalogue.locale,<EOL>domain))<EOL><DEDENT><DEDENT>
Loads translation found in a directory.

@type directory: string
@param directory: The directory to search

@type catalogue: MessageCatalogue
@param catalogue: The message catalogue to dump

@raises: ValueError