(chinese_texts, translations, lang)
| 171 | |
| 172 | # 锁 |
| 173 | def translate_worker(chinese_texts, translations, lang): |
| 174 | for idx, chinese_text in chinese_texts: |
| 175 | translated_text = translate_text(chinese_text, lang) |
| 176 | if translated_text: |
| 177 | # 使用锁确保线程安全地修改 translations |
| 178 | with translation_lock: |
| 179 | translations[(idx, chinese_text)] = translated_text |
| 180 | |
| 181 | |
| 182 | # 翻译并保存结果,覆盖原文件 |
nothing calls this directly
no test coverage detected