Skip to content

ZLMediaKit/translation_issues

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

translation_issues

Automatically translate GitHub issues/discussions/pull requests into English using AI.

中文

Acknowledgements

This project references and utilizes some code from the ossrs/discussion-translation project. Special thanks to the original author for their work.

Features

  • Automatically translate specified issues into English
  • Automatically translate specified discussions into English
  • Automatically translate specified pull requests into English
  • Batch translate all issues/discussions/pull requests of a repository into English
  • Option to use GPT4 or GEMINI-PRO model for translation
  • Preserve original text after translation to English
  • Automatically add tags to translated content to prevent duplicate translations
  • Built-in webhook server for automatic translation of issues/discussions/pull requests into English

Deployment

Deploy on Ubuntu 20.04:

git clone https://github.com/ZLMediaKit/translation_issues.git
cd translation_issues
chmod +x ./run.sh
sudo ./run.sh

Enable webhook server and auto-start on boot:

sudo ./run.sh auto_start

Usage

View help:

./run.sh --help

2023-12-30

View help for a specific command:

./run.sh trans_issues --help

2023-12-30

Set environment variables:

./run.sh update_env

[Note: If you are using the GEMINI-PRO model, keep OPENAI_API_KEY empty, as it will prioritize translation using the GPT4 model.]

Translate a specific issue:

./run.sh trans_issues --input-url https://github.com/your-org/your-repository/issues/1

[Note: If you haven't set environment variables in .env, you need to specify the github-token and gemini-key or openai-key]

./run.sh trans_issues --input-url https://github.com/your-org/your-repository/issues/1 --github-token ghp_xxx --gemini-key xxxx

Translate a specific discussion:

./run.sh trans_discussions --input-url https://github.com/your-org/your-repository/discussions/1

Translate a specific PR:

./run.sh trans_pr --input-url https://github.com/your-org/your-repository/pull/1

Batch translate all issues/discussions/pull requests of a specific repository:

# Translate issues, limit 10 translations per batch
./run.sh batch_trans --input-url https://github.com/your-org/your-repository --query-filter issue --query-limit 10
# Translate discussions, limit 10 translations per batch
./run.sh batch_trans --input-url https://github.com/your-org/your-repository --query-filter discussion --query-limit 10
# Translate pull requests, limit 10 translations per batch
./run.sh batch_trans --input-url https://github.com/your-org/your-repository --query-filter pr --query-limit 10

Start the GitHub webhook server:

./run.sh start_server

After enabling the webhook server, you need to configure a webhook in GitHub. Please refer to this guide for configuration.

The Payload URL for the webhook is: http://your-ip:port/api/v1/hooks

About

AI automatic translation issues

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published