Exemplo n.º 1
0
    def handle(self, *args, **options):
        if settings.CENTRAL_SERVER:
            raise CommandError(
                "This must only be run on distributed servers server.")

        lang_code = lcode_to_ietf(options["lang_code"])
        software_version = options["software_version"]
        logging.info(
            "Downloading language pack for lang_code=%s, software_version=%s" %
            (lang_code, software_version))

        # Download the language pack
        try:
            if options['file']:
                self.start(
                    _("Using local language pack '%(filepath)s'") %
                    {"filepath": options['file']})
                zip_filepath = options['file']
            else:
                self.start(
                    _("Downloading language pack '%(lang_code)s'") %
                    {"lang_code": lang_code})
                zip_filepath = get_language_pack(lang_code,
                                                 software_version,
                                                 callback=self.cb)

            # Unpack into locale directory
            self.next_stage(
                _("Unpacking language pack '%(lang_code)s'") %
                {"lang_code": lang_code})
            unpack_language(lang_code, zip_filepath=zip_filepath)

            #
            self.next_stage(
                _("Creating static files for language pack '%(lang_code)s'") %
                {"lang_code": lang_code})
            update_jsi18n_file(lang_code)

            self.next_stage(
                _("Moving files to their appropriate local disk locations."))
            move_dubbed_video_map(lang_code)
            move_exercises(lang_code)
            move_srts(lang_code)
            move_video_sizes_file(lang_code)

            self.next_stage(_("Invalidate caches"))
            caching.invalidate_all_caches()

            self.complete(
                _("Finished processing language pack %(lang_code)s") %
                {"lang_code": lang_code})
        except Exception as e:
            self.cancel(stage_status="error",
                        notes=_("Error: %(error_msg)s") %
                        {"error_msg": unicode(e)})
            raise
Exemplo n.º 2
0
    def handle(self, **options):
        if not settings.CENTRAL_SERVER and not options['test_wrappings']:
            raise CommandError("Wrappings should be run on the central server, and downloaded through languagepackdownload to the distributed server.")

        # All commands must be run from project root
        change_dir_to_project_root()

        # (safety measure) prevent any english or test translations from being uploaded
        delete_current_templates()

        # Create new files
        run_makemessages()

        # Handle flags
        if options["test_wrappings"]:
            generate_test_files()
            update_jsi18n_file()  # needed for test purposes only--regenerate the static js file
        else:
            update_templates()
Exemplo n.º 3
0
    def handle(self, *args, **options):
        if settings.CENTRAL_SERVER:
            raise CommandError("This must only be run on distributed servers server.")

        lang_code = lcode_to_ietf(options["lang_code"])
        software_version = options["software_version"]
        logging.info("Downloading language pack for lang_code=%s, software_version=%s" % (lang_code, software_version))

        # Download the language pack
        try:
            if options['file']:
                self.start(_("Using local language pack '%(filepath)s'") % {"filepath": options['file']})
                zip_filepath = options['file']
            else:
                self.start(_("Downloading language pack '%(lang_code)s'") % {"lang_code": lang_code})
                zip_filepath = get_language_pack(lang_code, software_version, callback=self.cb)

            # Unpack into locale directory
            self.next_stage(_("Unpacking language pack '%(lang_code)s'") % {"lang_code": lang_code})
            unpack_language(lang_code, zip_filepath=zip_filepath)

            #
            self.next_stage(_("Creating static files for language pack '%(lang_code)s'") % {"lang_code": lang_code})
            update_jsi18n_file(lang_code)


            self.next_stage(_("Moving files to their appropriate local disk locations."))
            move_dubbed_video_map(lang_code)
            move_exercises(lang_code)
            move_srts(lang_code)
            move_video_sizes_file(lang_code)

            self.next_stage(_("Invalidate caches"))
            caching.invalidate_all_caches()

            self.complete(_("Finished processing language pack %(lang_code)s") % {"lang_code": lang_code})
        except Exception as e:
            self.cancel(stage_status="error", notes=_("Error: %(error_msg)s") % {"error_msg": unicode(e)})
            raise
Exemplo n.º 4
0
    def handle(self, **options):
        if not settings.CENTRAL_SERVER and not options['test_wrappings']:
            raise CommandError(
                "Wrappings should be run on the central server, and downloaded through languagepackdownload to the distributed server."
            )

        # All commands must be run from project root
        change_dir_to_project_root()

        # (safety measure) prevent any english or test translations from being uploaded
        delete_current_templates()

        # Create new files
        run_makemessages()

        # Handle flags
        if options["test_wrappings"]:
            generate_test_files()
            update_jsi18n_file(
            )  # needed for test purposes only--regenerate the static js file
        else:
            update_templates()