Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

只要开启了翻译,就翻译标题 #440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions javsp/web/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
def translate_movie_info(info: MovieInfo):
"""根据配置翻译影片信息"""
# 翻译标题
if info.title and Cfg().translator.fields.title and info.ori_title is None:
# 只要开启了翻译,就翻译标题,可以将繁体标题翻译为简体或者使用AI时对标题进行润色。
if info.title and Cfg().translator.fields.title:
result = translate(info.title, Cfg().translator.engine, info.actress)
if 'trans' in result:
info.ori_title = info.title
# 由于翻译标题有可能是把已经翻译过的标题进行润色,因此只有原始标题为空时才更新原始标题
if info.ori_title is None:
info.ori_title = info.title
info.title = result['trans']
# 如果有的话,附加断句信息
if 'orig_break' in result:
Expand Down
Loading