def main()

in translate.py [0:0]


def main(api_token, project_id, languages, tags, file_path, header_comment):
    client = POEditorAPI(api_token)
    # See also: https://github.com/sporteasy/python-poeditor/pull/15
    client.FILTER_BY += 'proofread'
    done = 0
    lock = threading.Lock()

    def export_worker(params):
        ((language_code, language_id), (tag, module)) = params
        output = file_path.format(language_id, module)
        (_, temp) = client.export(project_id, language_code, 'android_strings', 'proofread', tag)
        try:
            if os.path.getsize(temp) > 0:
                try:
                    os.makedirs(os.path.dirname(output))
                except FileExistsError:
                    pass
                with open(output, 'w') as writer:
                    with open(temp) as reader:
                        head = reader.readline()
                        assert head.startswith('<?xml')
                        writer.write(head)
                        writer.write(header_comment)
                        for line in reader:
                            writer.write(line)
        finally:
            os.remove(temp)
        with lock:
            nonlocal done
            done += 1
            print("{}/{}: {}".format(done, len(languages) * len(tags), output))

    pool = ThreadPool(max(64, multiprocessing.cpu_count()))
    pool.map(export_worker, itertools.product(languages.items(), tags.items()))