English Version | Chinese Version README.md
With the emergence of ChatGPT, the author thought that the translation task of this project could be handed over to GPT for implementation. Through the open source project gpt4free
, we can achieve free GPT API, hoping to improve the translation capability of this project!
-
Version 1 translation method: Implemented through third-party Linux packages (
translation.sh
)- Translation effect: Poor, similar to Google translation
- Translation speed: Slow
- Stability: High, can ensure that every translation is correct
-
Version 2 translation method: Translation task is performed through GPT (
translation.py
)- Translation effect: Good
- Translation speed: Sometimes fast, sometimes slow
- Stability: Low
Since
gpt4free
is realized by reverse engineering to implement free API calling, anomalies may occur during the calling process. The author addedretry
technology when calling the api function to avoid translation failure. As a result, the translation speed would slow down with the increase of retry times.
Please note that
gpt4free
has different Providers which provide the source of api calling. If you cannot use the automatic translation tool of this project normally. The problem usually comes from the fact that the Provider currently in use has become Inactive.Therefore, in your
translate-readme.yml
file, you can set this parameter yourself (default isg4f.Provider.DeepAi
).In addition, as it is a generative AI technology, it cannot ensure that each translation is correct. If the translation effect is not good, you can perform the translation several times.
-
We all know that writing documentation is time-consuming, but now there is a solution that can save you half the time. This is our
action-translate-readme
-
With this tool, you can automatically translate the
README.md
document, not only can translate, but also translate inline code, emoticons, code blocks, HTML tags, links and other elements. -
Its operation principle is automated through
Github Actions
, only need to push the updated README file, the translated README(zh or en) file can be updated automatically -
Continuous integration (CI)
-
Automatically translate the language of the README file through Github Action
-
Updating
README.md
and pushing it will automatically updateREADME.zh-TW.md
(updatingREADME.zh-TW.md
will automatically updateREADME.md
) -
Save half the time writing documentation.
- Untranslated:
-
In-line code (
inline_code
) -
For emoticons
-
Code block
-
HTML tag
-
Link
-
-
Click the ⭐ icon to add this project to your Github repository.
-
Set up your
Github Token
:-
Create a new
Github Secret Token
- Setting
- Developer settings
- Personal access token -
Tokens(classic)
- Generate new token
- Choose scope:
repo
andworkflow
- Keep your secret token (don't lose it, you will need to paste it later)
-
Create a new
repository secret
- In your repository -
settings
Securits and variables
Actions
New repository secret
- Tag with
token
and name it (eg:Action_Bot
)
- In your repository -
-
-
Create the README language you want:
README.md
,READM.zh-TW.md
, ... -
Create your action example in the directory
.github/workflows/your_action.yml
.# .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@v1 # Based on the tag with: token: ${{ secrets.Action_Bot }} # Based on step2 name
-
Now you can update
README.md
, and it will automatically generate a translated version!
- See Test Document
- Update the test document with our tool