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"] # Download the language pack try: self.start("Downloading language pack '%s'" % lang_code) zip_file = get_language_pack(lang_code, software_version) # Unpack into locale directory self.next_stage("Unpacking language pack '%s'" % lang_code) unpack_language(lang_code, zip_file) # Update database with meta info self.next_stage("Updating database for language pack '%s'" % lang_code) update_database(lang_code) # self.next_stage("Creating static files for language pack '%s'" % lang_code) update_jsi18n_file(lang_code) # move_srts(lang_code) self.complete("Finished processing language pack %s" % lang_code) except Exception as e: self.cancel(stage_status="error", notes="Error: %s" % e) raise
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()
def handle(self, *args, **options): if settings.CENTRAL_SERVER: raise CommandError( "This must only be run on distributed servers server.") code = convert_language_code_format(options["lang_code"]) software_version = options["software_version"] if code == settings.LANGUAGE_CODE: logging.info( "Note: language code set to default language. This is fine (and may be intentional), but you may specify a language other than '%s' with -l" % code) if software_version == version.VERSION: logging.info( "Note: software version set to default version. This is fine (and may be intentional), but you may specify a software version other than '%s' with -s" % version.VERSION) # Download the language pack try: self.start("Downloading language pack '%s'" % code) zip_file = get_language_pack(code, software_version) except CommandError as e: # 404 sys.exit( '404 Not found: Could not download language pack file %s ' % _language_pack_url(code, software_version)) # Unpack into locale directory self.next_stage("Unpacking language pack '%s'" % code) unpack_language(code, zip_file) # Update database with meta info self.next_stage("Updating database for language pack '%s'" % code) update_database(code) # self.next_stage("Creating static files for language pack '%s'" % code) update_jsi18n_file(code) # move_srts(code) self.complete("Finished processing language pack %s" % code)
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 move_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()