(file_path, target_langs)
| 93 | |
| 94 | |
| 95 | def translate_localized(file_path, target_langs): |
| 96 | chinese_texts = read_file_to_memory(file_path) |
| 97 | file_lock = threading.Lock() |
| 98 | max_threads = 5 |
| 99 | with ThreadPoolExecutor(max_threads) as executor: |
| 100 | futures = [ |
| 101 | executor.submit(translate_task, file_path, lang, chinese_texts, file_lock) |
| 102 | for lang in target_langs |
| 103 | ] |
| 104 | for future in futures: |
| 105 | future.result() |
| 106 | |
| 107 | |
| 108 | def main(): |
no test coverage detected