from PyDeepLX import PyDeepLX
# 定义文件路径
original_file_path = "S:\\temp\\split_chunks_test\\1.txt"
# 使用 open 函数打开文件,并读取内容
with open(original_file_path, 'r', encoding='utf-8') as file:
text = file.read()
translated_text = PyDeepLX.translate(text,targetLang='zh')
# 将 translated_text 写入新文件
with open("S:\\temp\\split_chunks_test\\1_tran.txt", 'w', encoding='utf-8') as new_file:
new_file.write(translated_text)
print(translated_text)