DEV Community

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

Posted on • Edited 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 multiple AI models.
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 Files into Any Languages with AI

🌎 Markdown Translation BOT

Maintainability GPT Translate

OpenAI Azure Anthropic Perplexity Google Groq Fireworks Mistral Cohere

English | 简体中文 | 繁體中文 | Español | हिंदी, हिन्दी | 한국어 | 日本語

This GitHub action translates your markdown files into multiple languages using multiple AI models.

Tip

Now Available: AI Models from Multiple Providers✨
We've expanded beyond OpenAI to support various AI model providers.
For a comprehensive list of supported providers and detailed information, please refer to our release notes.


🧐 Current Status
  • The action supports translating markdown(.md), markdown-jsx(.mdx), json(.json) 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







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.