Logo Search packages:      
Sourcecode: qbzr version File versions

def qbzr::extras::build_mo::build_mo::run (   self  ) 

Run msgfmt for each language

Definition at line 75 of file build_mo.py.

00075                  :
        """Run msgfmt for each language"""
        if not self.lang:
            return

        if find_executable('msgfmt') is None:
            log.warn("GNU gettext msgfmt utility not found!")
            log.warn("Skip compiling po files.")
            return

        if find_executable('msginit') is None:
            log.warn("GNU gettext msginit utility not found!")
            log.warn("Skip creating English PO file.")
        else:
            log.info('Creating English PO file...')
            self.spawn(['msginit',
                '--no-translator',
                '-l', 'en',
                '-i', os.path.join(self.source_dir, 'qbzr.pot'),
                '-o', os.path.join(self.source_dir, 'qbzr-en.po'),
                ])

        basename = self.output_base
        if not basename.endswith('.mo'):
            basename += '.mo'

        for lang in self.lang:
            po = os.path.join('po', lang + '.po')
            if not os.path.isfile(po):
                po = os.path.join('po', 'qbzr-' + lang + '.po')
            dir_ = os.path.join(self.build_dir, lang, 'LC_MESSAGES')
            self.mkpath(dir_)
            mo = os.path.join(dir_, basename)
            if self.force or newer(po, mo):
                log.info('Compile: %s -> %s' % (po, mo))
                self.spawn(['msgfmt', '-o', mo, po])


build.sub_commands.insert(0, ('build_mo', None))
build.sub_commands.insert(0, ('build_mo', None))


Generated by  Doxygen 1.6.0   Back to index