Automate Document I18n by Leveraging OpenAI's GPT-3.5-Turbo (ChatGPT)
正體中文 | 简体中文 | 日本語 | Français | Deutsch | Español | 한국어
^ by ai18n --to zh-TW --to zh-CN --to ja --to fr --to de --to es --to ko README.md
pnpm i -g @jacoblincool/ai18n
Use
npm
oryarn
to install is also fine.
You need to set
OPENAI_API_KEY
environment variable first.
# Show help
ai18n --help
ai18n [options] <files...>
-V
,--version
: Output the version number of the ai18n CLI tool.--to <language>
: Specify the target language for translation. This can be a single language or a comma-separated list of multiple languages. By default, no target language is specified.--out <directory>
: Specify the output directory for translated files. By default, the output files will be saved in a directory called "translated" in the current working directory.--inline
: Enable inline translation. By default, this option is disabled.-h
,--help
: Display help for the ai18n CLI tool.
If you enable the inline
mode, the translated text will be inserted into the file and no new file will be created.
For example, if you have a file called README.md
with the following content:
# ai18n
Automate Document I18n by Leveraging OpenAI's GPT-3.5-Turbo (ChatGPT)
<!-- ai18n [zh-tw] --><!-- /ai18n [zh-tw] -->
After running the following command:
ai18n --to zh-tw --inline README.md
The content of README.md
will be changed to:
# ai18n
Automate Document I18n by Leveraging OpenAI's GPT-3.5-Turbo (ChatGPT)
<!-- ai18n [zh-tw] -->
# ai18n
透過利用 OpenAI 的 GPT-3.5-Turbo (ChatGPT) 來自動化文件國際化。
<!-- /ai18n [zh-tw] -->