Esempio n. 1
0
    def build_message_files(self):
        """
        For each locale/*.po, build .mo file in target locale directory.

        As a side effect we build wammu.desktop file with updated
        translations here.
        """
        desktop_translations = {}
        for (_locale, _src, _dst) in list_message_files():
            _build_dst = os.path.join(self.build_base, _dst)
            destdir = os.path.dirname(_build_dst)
            if not os.path.exists(destdir):
                self.mkpath(destdir)
            distutils.log.info('compiling %s -> %s' % (_src, _build_dst))
            msgfmt.make(_src, _build_dst)
            desktop_translations[_locale] = msgfmt.DESKTOP_TRANSLATIONS

        desktop = os.path.join(self.build_base, 'wammu.desktop')
        in_desktop = file('wammu.desktop.in', 'r')
        out_desktop = file(desktop, 'w')
        for line in in_desktop:
            if line.startswith('_Name'):
                out_desktop.write('Name=%s\n' % msgfmt.DESKTOP_NAME)
                for loc in desktop_translations.keys():
                    if desktop_translations[loc].has_key('Name'):
                        out_desktop.write(
                            'Name[%s]=%s\n' %
                            (loc, desktop_translations[loc]['Name']))
            elif line.startswith('_GenericName'):
                out_desktop.write('GenericName=%s\n' %
                                  msgfmt.DESKTOP_GENERIC_NAME)
                for loc in desktop_translations.keys():
                    if desktop_translations[loc].has_key('GenericName'):
                        out_desktop.write(
                            'GenericName[%s]=%s\n' %
                            (loc, desktop_translations[loc]['GenericName']))
            elif line.startswith('_Comment'):
                out_desktop.write('Comment=%s\n' % msgfmt.DESKTOP_COMMENT)
                for loc in desktop_translations.keys():
                    if desktop_translations[loc].has_key('Comment'):
                        out_desktop.write(
                            'Comment[%s]=%s\n' %
                            (loc, desktop_translations[loc]['Comment']))
            else:
                out_desktop.write(line)
Esempio n. 2
0
    def build_message_files(self):
        """
        For each locale/*.po, build .mo file in target locale directory.

        As a side effect we build wammu.desktop file with updated
        translations here.
        """
        translations = {}
        for (_locale, _src, _dst) in list_message_files():
            _build_dst = os.path.join(self.build_base, _dst)
            destdir = os.path.dirname(_build_dst)
            if not os.path.exists(destdir):
                self.mkpath(destdir)
            distutils.log.info('compiling %s -> %s' % (_src, _build_dst))
            msgfmt.make(_src, _build_dst)
            translations[_locale] = msgfmt.DESKTOP_TRANSLATIONS

        self.build_desktop_file(translations)
        self.build_appdata_file(translations)
Esempio n. 3
0
    def build_message_files(self):
        """
        For each locale/*.po, build .mo file in target locale directory.

        As a side effect we build wammu.desktop file with updated
        translations here.
        """
        translations = {}
        for (_locale, _src, _dst) in list_message_files():
            _build_dst = os.path.join(self.build_base, _dst)
            destdir = os.path.dirname(_build_dst)
            if not os.path.exists(destdir):
                self.mkpath(destdir)
            distutils.log.info('compiling %s -> %s' % (_src, _build_dst))
            msgfmt.make(_src, _build_dst)
            translations[_locale] = msgfmt.DESKTOP_TRANSLATIONS

        self.build_desktop_file(translations)
        self.build_appdata_file(translations)
Esempio n. 4
0
    def build_message_files (self):
        """
        For each locale/*.po, build .mo file in target locale directory.

        As a side effect we build wammu.desktop file with updated
        translations here.
        """
        desktop_translations = {}
        for (_locale, _src, _dst) in list_message_files():
            _build_dst = os.path.join(self.build_base, _dst)
            destdir = os.path.dirname(_build_dst)
            if not os.path.exists(destdir):
                self.mkpath(destdir)
            distutils.log.info('compiling %s -> %s' % (_src, _build_dst))
            msgfmt.make(_src, _build_dst)
            desktop_translations[_locale] = msgfmt.DESKTOP_TRANSLATIONS

        desktop = os.path.join(self.build_base, 'wammu.desktop')
        in_desktop = file('wammu.desktop.in', 'r')
        out_desktop = file(desktop, 'w')
        for line in in_desktop:
            if line.startswith('_Name'):
                out_desktop.write('Name=%s\n' % msgfmt.DESKTOP_NAME)
                for loc in desktop_translations.keys():
                    if desktop_translations[loc].has_key('Name'):
                        out_desktop.write('Name[%s]=%s\n' % (loc, desktop_translations[loc]['Name']))
            elif line.startswith('_GenericName'):
                out_desktop.write('GenericName=%s\n' % msgfmt.DESKTOP_GENERIC_NAME)
                for loc in desktop_translations.keys():
                    if desktop_translations[loc].has_key('GenericName'):
                        out_desktop.write('GenericName[%s]=%s\n' % (loc, desktop_translations[loc]['GenericName']))
            elif line.startswith('_Comment'):
                out_desktop.write('Comment=%s\n' % msgfmt.DESKTOP_COMMENT)
                for loc in desktop_translations.keys():
                    if desktop_translations[loc].has_key('Comment'):
                        out_desktop.write('Comment[%s]=%s\n' % (loc, desktop_translations[loc]['Comment']))
            else:
                out_desktop.write(line)