GitHub Action
Auto Translate Readme
Note
The v1
version of the translator is implemented through Linux
third-party packages; the v2
version is implemented through generative AI for translation.
-
We all know that writing README documents is time-consuming, but now there is a solution that can save you half the time. This is our
action-translate-readme
-
Translate different language versions of README through generative AI
-
Automatically submit (commit, push) the translated files through Github Actions (CI/CD)
-
For example: writing or modifying the English version README, automatically generate Traditional Chinese, Simplified Chinese, French, etc. versions of README
Important
Since generative AI models have a chance of producing problematic results each time, it is recommended to use branch testing and try several times.
Warning
If you encounter the following error: Error: Input required and not supplied: token
, please follow the steps below to ensure that a Token
has been created, or check if the Token
has expired!
-
Click the ⭐ icon to add this project to your Github repository.
-
Set up your
Github Token
:-
Create a new
Github Secret Token
- Setup
- Developer settings
- Personal access tokens -
Tokens(classic)
- Generate new token
- Select token lifecycle - recommended to use unlimited
- Select scopes:
repo
andworkflow
- Keep your secret token (do not lose it, you will need to paste it later)
-
Create a new
repository secret
- In your repository -
settings
Securities and variables
Actions
New repository secret
- Fill in the label with
token
and name it (e.g.,Action_Bot
)
- In your repository -
-
-
GPT Model Selection
g4f
: Default usesg4f
for OpenAI calls and completes translation tasks.zhipuai
: If you need stable translation, you can register an account on the Zhipu AI Platform and apply for an API KEY. This is a completely free, no-credit-card-required GPT model solution
-
Create your action example in the directory
.github/workflows/your_action.yml
. You can directly copy the following:# .github/workflows/translate.yml name: Translate Readme on: push: branches: ['**'] jobs: translate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 3 - name: Auto Translate uses: Lin-jun-xiang/action-translate-readme@v2 # Based on the tag with: token: ${{ secrets.Action_Bot }} # Based on step2 name zhipuai: ${{ secrets.zhipuai_api_key }} # Based on step3 langs: "en,zh-TW,zh-CN,French,Arabic" # You can define any langs
Pay special attention to three parameters in the
.yml
:token
: Based on step 2, the token created in reposzhipuai
: The provider of GPT, if provided, use the Zhipu AI platform model, otherwise default tog4f
, needs to be created in reposlangs
: The language versions you want to generate, make sure to separate different languages with,
, for example:"en"
: Translate only the English version"en,zh-TW"
: Translate English and Traditional Chinese"French,Arabic"
: Translate French and Arabic
-
Now you can update
README.md
, it will automatically generate a translated version!
- View the test document
- Use our tool to update the test document