def run(self):
        """
           Compile all message catalogs .po files into .mo files.
           Skips not changed file based on source mtime.
        """
        # thanks to deluge guys ;)
        po_dir = os.path.join(os.path.dirname(__file__), 'webant', 'translations')
        print('Compiling po files from "{}"...'.format(po_dir))
        for lang in os.listdir(po_dir):
            sys.stdout.write("\tCompiling {}... ".format(lang))
            sys.stdout.flush()
            curr_lang_path = os.path.join(po_dir, lang)
            for path, dirs, filenames in os.walk(curr_lang_path):
                for f in filenames:
                    if f.endswith('.po'):
                        src = os.path.join(path, f)
                        dst = os.path.join(path, f[:-3] + ".mo")
                        if not os.path.exists(dst) or self.force:
                            msgfmt.make(src, dst)
                            print("ok.")
                        else:
                            src_mtime = os.stat(src)[8]
                            dst_mtime = os.stat(dst)[8]
                            if src_mtime > dst_mtime:
                                msgfmt.make(src, dst)
                                print("ok.")
                            else:
                                print("already up to date.")
        print('Finished compiling translation files.')
def run ( self ) : po_dir = os . path . join ( os . path . dirname ( __file__ ) , 'webant' , 'translations' ) print ( 'Compiling po files from "{}"...' . format ( po_dir ) ) for lang in os . listdir ( po_dir ) : sys . stdout . write ( "\tCompiling {}... " . format ( lang ) ) sys . stdout . flush ( ) curr_lang_path = os . path . join ( po_dir , lang ) for path , dirs , filenames in os . walk ( curr_lang_path ) : for f in filenames : if f . endswith ( '.po' ) : src = os . path . join ( path , f ) dst = os . path . join ( path , f [ : - 3 ] + ".mo" ) if not os . path . exists ( dst ) or self . force : msgfmt . make ( src , dst ) print ( "ok." ) else : src_mtime = os . stat ( src ) [ 8 ] dst_mtime = os . stat ( dst ) [ 8 ] if src_mtime > dst_mtime : msgfmt . make ( src , dst ) print ( "ok." ) else : print ( "already up to date." ) print ( 'Finished compiling translation files.' )
Compile all message catalogs .po files into .mo files.
           Skips not changed file based on source mtime.