Пример #1
0
 def compile_message_catalogs(self):
     for fname in self.list_message_catalogs():
         dest = fname.replace(".po", ".mo")
         msgfmt.make(fname, dest)
         if os.path.exists(dest):
             print "Compiled %s OK" % fname
         else:
             print "Compilation of %s failed!" % fname
Пример #2
0
    def compile_catalogs(self, codes):
        locales = self.locales_directory()
        for code in codes.split(','):
            path = os.path.join(locales, code, 'LC_MESSAGES', 'messages.po')
            if not os.path.exists(path):
                continue

            dest = path.replace('.po', '.mo')
            #run msgfmt on file...
            msgfmt.make(path, dest)