lukeaxu / gpt-translate

💬Translate Markdown into Any Languages with GPT
MIT License
0 stars 0 forks source link

🌎 Markdown Translation BOT

Maintainability GPT Translate

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


Summary of this README by GPT-4

  • This is a GitHub Action that uses GPT-3.5 to translate markdown files into multiple languages.
  • To use, create a comment with /gpt-translate or /gt in an issue or pull request, specifying input/output file paths and target language.
  • The translated files will be created as a pull request (on issues) or added to the existing pull request as a new commit (on pull requests).


🧐 Current Status

- The action supports translating single markdown 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. I'm considering per-directory translation and multiple selection features for future implementation.

🔧 Setup

Repository Settings

1. Settings > Actions > General

2. Settings > Secrets and variables > Actions

GitHub Actions Workflow Settings

Required

Recommended (To minimize unnecessary run time)

👇 Here is a minimal workflow example:

# .github/workflows/gpt-translate.yml
name: GPT Translate

on:
  issue_comment:
    types: [ created ]

jobs:
  gpt_translate:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Run GPT Translate
        if: |
          contains(github.event.comment.body, '/gpt-translate') || 
          contains(github.event.comment.body, '/gt')
        uses: 3ru/gpt-translate@v1.0
        with:
          apikey: ${{ secrets.OPENAI_API_KEY }}

💡 Usage

/gpt-translate [input filepath] [output filepath] [target language] 

You can use /gt as a shorthand for /gpt-translate.

1.Create a comment with /gpt-translate or /gt in an issue or pull request.

2.【On issue】Translated files will be created as a pull request.

2.【On pull request】Translated files will be added to the pull request with new commit.

In other words, if you keep commenting on an issue, new PRs will continuously be created. If you keep commenting on a PR, new commits will continuously be added to that PR.

📝 Example

/gpt-translate README.md zh-TW/README.md traditional-chinese

Translate README.md into traditional Chinese and place it under the zh-TW directory.

🌐 Supported Languages

Any language interpreted by GPT-3.5

📃 License

MIT License