Ejemplo n.º 1
0
    def handle_translation_project(self, tp, **options):
        """Push translation project units to local TM."""
        for store in tp.stores.iterator():
            self.stdout.write("Adding translations from %r" % (store))

            with transaction.atomic():
                for unit in Unit.objects.filter(
                        store=store, state__gte=TRANSLATED).iterator():
                    tmunit = TMUnit().create(unit)
                    tmunit.save()
Ejemplo n.º 2
0
def create_local_tm():
    """Create the local TM using translations from existing projects.

    Iterates over all the translation units and creates the corresponding local
    TM units.
    """
    logging.info('About to create local TM using existing translations')

    with transaction.commit_on_success():
        for unit in Unit.objects.filter(state__gte=TRANSLATED).iterator():
            tmunit = TMUnit().create(unit)
            tmunit.save()

        logging.info('Successfully created local TM from existing translations')