meine
meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…
使用 ChatGPT 自动将 Markdown 文件批量翻译为多语言 | Auto translate Markdown files to multi languages using ChatGPT
git clone https://github.com/linyuxuanlin/Auto-i18n.gitlinyuxuanlin/Auto-i18nAuto-i18n 是一个使用 ChatGPT 自动将 Markdown 文件批量翻译为多语言的工具。它实现了博客文章 i18n(Internationalization) 的全自动化。你仅需将博文推送至 GitHub 仓库,即可借助 GitHub Actions 实现自动转译为多种语言。(目前支持英语、西班牙语和阿拉伯语,后续将提供更多语言支持)
Auto-i18n 的主要特性:
env_template.py 重命名为 env.py,并提供你的 ChatGPT API。如果你没有自己的 API,可以到 GPT_API_free 申请到一个免费的;也可以借助 go-chatgpt-api 把网页版 ChatGPT 转 API 使用。pip install -r requirements.txt 。python auto-translater.py 运行程序,它将会自动处理测试目录 testdir/to-translate 下的所有 Markdown 文件,批量翻译为英语、西班牙语、阿拉伯语。(后续将提供更多语言支持)程序 auto-translater.py 的运行逻辑如下:
testdir/to-translate 下的所有 Markdown 文件,你可以在 exclude_list 变量中排除不需要翻译的文件。processed_list.txt 中。下次运行程序时,已处理的文件将不会再次翻译。> This post was originally written in English.(注意在上下各留一个空行),以便程序识别。请参考 测试文章_en.md。[translate](同样需要在上下各留一个空行)。这将会忽略 exclude_list 和 processed_list 的规则,强制进行翻译处理。请参考 测试文章_force-mark.md。front_matter_translation_rules 选择以下处理方式:
你可以在自己项目仓库下创建 .github/workflows/ci.yml,当检测到 GitHub 仓库更新后,可以使用 GitHub Actions 自动进行翻译处理,并自动 commit 回原仓库。
ci.yml 的内容可参考模板:ci_template.yml
你需要在仓库的 Settings - Secrets and variables - Repository secrets 中添加两个 secrets:CHATGPT_API_BASE 和 CHATGPT_API_KEY,并在程序 auto-translater.py 中将 import env 语句注释掉。
dir_to_translate dir_translated_en dir_translated_es dir_translated_ar processed_list)。欢迎你参与本项目的改进!如果您想要贡献代码、报告问题或提出建议,请查看 贡献指南。
本项目采用 MIT 许可证。
如果你在使用 Auto-i18n 时遇到任何问题,或者需要技术支持,请随时 提交问题。
我的博客使用 Auto-i18n 实现了多语言支持,你可以到 Power's Wiki 查看 Demo 效果。
more like this
meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…
Create and add progress bars, Office365 Files and Dropbox Paper papers by labels and link them to your Todoist tasks.
search projects, people, and tags