def main(): """Create a Whoosh index for a PO file. Given a PO file, enumerates all the strings, and creates a Whoosh index to be able to search later. """ print("Create Whoosh index from a PO file") print("Use --help for assistance") start_time = datetime.datetime.now() try: locale.setlocale(locale.LC_ALL, '') except Exception as detail: print("Exception: " + str(detail)) po_directory, debug_keyword, projects_names = read_parameters() indexCreator = IndexCreator(po_directory, debug_keyword, projects_names) indexCreator.create() indexCreator.process_projects() ctx = { 'date': datetime.date.today().strftime("%d/%m/%Y"), 'projects': str(indexCreator.projects), 'words': locale.format_string("%d", indexCreator.words, grouping=True), } write_index_json(ctx) print( "Time used to create the index: {0} ".format(datetime.datetime.now() - start_time))
def main(): """Create a Whoosh index for a PO file. Given a PO file, enumerates all the strings, and creates a Whoosh index to be able to search later. """ print("Create Whoosh index from a PO file") print("Use --help for assistance") start_time = datetime.datetime.now() try: locale.setlocale(locale.LC_ALL, '') except Exception as detail: print("Exception: " + str(detail)) po_directory, debug_keyword, projects_names = read_parameters() indexCreator = IndexCreator(po_directory, debug_keyword, projects_names) indexCreator.create() indexCreator.process_projects() ctx = { 'date': datetime.date.today().strftime("%d/%m/%Y"), 'projects': str(indexCreator.projects), 'words': locale.format_string("%d", indexCreator.words, grouping=True), } process_template("web/templates/statistics.mustache", "statistics.html", ctx) ctx = { # This is the list of projects to display for the user to select. 'options': sorted(indexCreator.options, key=lambda x: x.lower()), } process_template("web/templates/select-projects.mustache", "select-projects.html", ctx) print( "Time used to create the index: {0} ".format(datetime.datetime.now() - start_time))
def main(): """Create a Whoosh index for a PO file. Given a PO file, enumerates all the strings, and creates a Whoosh index to be able to search later. """ print("Create Whoosh index from a PO file") print("Use --help for assistance") start_time = time.time() try: locale.setlocale(locale.LC_ALL, '') except Exception as detail: print("Exception: " + str(detail)) po_directory, debug_keyword, projects_names = read_parameters() indexCreator = IndexCreator(po_directory, debug_keyword, projects_names) indexCreator.create() indexCreator.process_projects() ctx = { 'date': datetime.date.today().strftime("%d/%m/%Y"), 'projects': str(indexCreator.projects), 'words': locale.format("%d", indexCreator.words, grouping=True), } process_template("web/templates/statistics.mustache", "statistics.html", ctx) ctx = { # This is the list of projects to display for the user to select. 'options': sorted(indexCreator.options, key=lambda x: x.lower()), } process_template("web/templates/select-projects.mustache", "select-projects.html", ctx) end_time = time.time() - start_time print("time used to create the index: " + str(end_time))