JacobLinCool / ai18n

Automate Document I18n by Leveraging OpenAI's GPT-3.5-Turbo (ChatGPT)

Home Page:http://jacoblin.cool/ai18n/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ai18n

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

Installation

pnpm i -g @jacoblincool/ai18n

Use npm or yarn to install is also fine.

Usage

You need to set OPENAI_API_KEY environment variable first.

# Show help
ai18n --help
ai18n [options] <files...>

Options

  • -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.

The inline Mode

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] -->

About

Automate Document I18n by Leveraging OpenAI's GPT-3.5-Turbo (ChatGPT)

http://jacoblin.cool/ai18n/

License:MIT License


Languages

Language:TypeScript 93.1%Language:Dockerfile 4.3%Language:Shell 1.8%Language:JavaScript 0.8%