DEV Community

Cover image for Translate Markdown to Any Language (GitHub Bot)
Ryuya
Ryuya

Posted on • Updated on

Translate Markdown to Any Language (GitHub Bot)

Most open-source projects are written in English, raising barriers to participation from speakers of other languages. In addition, translation is a labor-intensive process, so documentation has yet to be internationalized to a great extent.
I have created a GitHub Actions that automatically translate documents using ChatGPT.(GPT-4 supported)
It is open source and requires an individual API key, but it is free.


Setup

All you need is an Open AI API Key and Actions workflow settings. Please see README for details.

To prevent your API KEY from being misused, we only allow people who have write permission to access the repository to run the bot.

Usage

Once the workflow is set up, comment on the issue or pr with a command to translate the input file.

/gpt-translate [input filepath] [output filepath] [target language] 
Enter fullscreen mode Exit fullscreen mode

Comment on Issues

Entering commandsView Actual Issues

Auto-generated PR

A PR is created depending on where the command is entered. (If you comment on a PR, the commit is added to that PR.)

Auto-generated PRView actual PR

Interestingly, I could translate Voynich's Manuscript (undeciphered script), ancient Greek, and other languages. (Not possible with GPT-4)
We could also build a kind of OSS document for time travelers :)

Human-in-the-Loop

Originally, the texts translated by GPT are of fairly high quality.

However, a human can also review the translation files created by this bot to perfect the translation further.

PR review
GitHub's function to accept reviews as is on a new commit allows us to build a very seamless translation experience.


If you have any suggestions for improvement or bugs, please feel free to write them in Issues!

🌎As a non-English speaking person, I would be happy if the various OSS are easier to understand!


Repo

Thanks for the 100 stars🌟

GitHub logo 3ru / gpt-translate

πŸ’¬Translate Markdown into Any Languages with AI

🌎 Markdown Translation BOT

Maintainability GPT Translate

This GitHub action translates your markdown files into multiple languages using the GPT-4, GPT-3.5 model.

⚠️Warning

The OpenAI API is currently not available for free. You need an API Key issued with a paid account to use this workflow.
image


🧐 Current Status
  • The action supports translating markdown(.md) and markdown-jsx(.mdx) files only.

  • The command can be executed exclusively by individuals with write permissions to the repository.

These limitations prevent API abuse by non-trusted parties.

πŸ”§ Setup

Repository Settings

1. Settings > Actions > General

  • Enable Read and write permissions
  • Enable Allow GitHub Actions to create and approve pull requests permissions

2. Settings > Secrets and variables > Actions

GitHub Actions Workflow Settings

Required

  • Provide the OPENAI_API_KEY as apiKey.
  • Set on to trigger when a comment is created (types: [ created ]…



This is my very first OSS and I would be happy if you like it.

Top comments (1)

Collapse
 
irina_kats profile image
Irina Kats

Thanks, seems interesting, I'd like to try this someday.