Skip to content

Commit

Permalink
Auto-translate README
Browse files Browse the repository at this point in the history
  • Loading branch information
Continuous Integration committed Sep 25, 2023
1 parent f5bf2eb commit 89847e2
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 66 deletions.
1 change: 1 addition & 0 deletions README.Arabic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

53 changes: 53 additions & 0 deletions README.French.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

第二次翻譯結果:

## Comment exécuter ?

1. Ajoutez ce projet à votre dépôt Github en cliquant sur l'icône :star:.

2. Configurez votre `Github Token` :

* [Créez un nouveau **`Github Secret Token`**](https://github.com/settings/tokens/new)
* Paramètres
* Paramètres du développeur
* Jetons d'accès personnels - `Tokens(classic)`
* Générer un nouveau jeton
* Choisissez le champ d'application : `repo` et `workflow`
* **Conservez** votre jeton secret (ne le perdez pas, vous en aurez besoin plus tard)

* Créez un nouveau **`repository secret`**
* Dans votre dépôt - `settings`
* `Securits and variables`
* `Actions`
* `New repository secret`
* Remplissez l'étiquette avec le `token` et donnez-lui un nom (par exemple : `Action_Bot`)

4. Créez le **README** dans la langue de votre choix : `README.md`, `READM.zh-TW.md`, ...

5. Créez votre exemple d'action dans le répertoire `.github/workflows/your_action.yml`. :

```yaml
# .github/workflows/translate.yml
name: Traduire Readme

on:
push:
branches: ['**']

jobs:
translate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 3

- name: Traduction automatique
uses: Lin-jun-xiang/action-translate-readme@v2 # Basé sur le tag
with:
token: ${{ secrets.Action_Bot }} # Basé sur le nom de l'étape 2
g4f_provider: g4f.Provider.DeepAi # Vous pouvez changer ce fournisseur
```
6. Vous pouvez maintenant mettre à jour le `README.md`, il générera automatiquement une version traduite !
101 changes: 35 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,52 @@
# action-translate-readme

[English Version](README.md) | [Chinese Version README.md](README.zh-TW.md)

# What's changed for action-translate-readme?

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`](https://github.com/xtekky/gpt4free), we can realize the free GPT API and hope to enhance the translation ability of this project!

* Version 1 translation method: implemented through third-party Linux packages (`translation.sh`)
* Translation effect: poor, similar to Google Translate
* Translation speed: slow
* Stability: high, can ensure correct translation every time

* Version 2 translation method: using GPT for translation task (`translation.py`)
* Translation effect: good
* Translation speed: fast or slow
* Stability: low

Since `gpt4free` uses reverse engineering to realize free API calls, the calling process may encounter abnormal problems. The author added `retry` technology (they will be executed again when abnormal events occur) when calling the API function to avoid translation failure. As a result, the translation speed will increase with the number of retries.

> Please **note** that there are [different providers](https://github.com/xtekky/gpt4free#models) in `gpt4free`, which are the sources that provide API calls. If you cannot use the automatic translation tool of this project normally, the problem usually comes from the provider currently used and is **inactive**. Therefore, you can set the [parameter](.github\workflows\translate-readme.yml) yourself in your `translate-readme.yml` file (default is `g4f.Provider.DeepAi`).
>
> In addition, since it is a **generative AI** technology, it cannot guarantee that each translation is correct. If the translation effect is not good, you can repeat it several times.
您好,這是Bing。我可以幫您完成翻譯的部分。以下是我翻譯的結果:

# action-translate-readme

# Introduction
[英文版](README.md) | [中文版 README.md](README.zh-TW.md)

* We all know that writing documents takes a lot of time, but now there is a solution that can save you half of the time. This is our `action-translate-readme`.

* With this tool, you can automatically translate the `README.md` file, not only can translate, but also translates various elements such as **inline code, emojis, code blocks, HTML tags and links.**
# 簡介

* Its operating principle is to achieve automation through `Github Actions`. Just push the updated README file, and the translated README (zh or en) file can be automatically updated.
* 我們都知道,撰寫 README 文件需要花費很多時間,但現在有一個解決方案可以節省一半的時間。這就是我們的 `action-translate-readme`

* Continuous integration (CI)
* 使用 `gpt3.5` 翻譯 README 的不同語言版本。

* **Automatically translate the language of README through Github Action**
* 通過 **Github Actions (CI/CD)** 自動提交和推送翻譯後的文件。

* Update `README.md` and push it. This action will automatically update `README.zh-TW.md`
(Updating `README.zh-TW.md` will automatically update `README.md`)
* 例如:**撰寫****修改**英文版的 README,並自動生成繁體中文、簡體中文、法文等版本的 README。

* Half of the time spent on writing documents is saved.
注意:版本 1 的翻譯是通過 `Linux` 中的第三方套件實現的;版本 2 是通過使用 [`g4f`](https://github.com/xtekky/gpt4free) 免費調用 openai api 實現的。

# Features

* Untranslated:
* Inline code (`inline_code`)
* Used for emoji
* Code block
* HTML tags
* Link
# 如何使用?

# How to use?
1. 點擊 :star: 圖標,將此項目添加到您的 Github 倉庫中。

1. Click on the :star: icon to add this item to your Github repository.
2. 設置您的 `Github Token`

2. Set your `Github Token`:
* [Create a new **`Github Secret Token`**](https://github.com/settings/tokens/new)
* Set
* Developer settings
* Personal access tokens - `Tokens(classic)`
* Generate new token
* Choose scope: `repo` and `workflow`
* **Keep** your secret token (do not throw it away, it needs to be pasted later)

* [創建一個新的 **`Github Secret Token`**](https://github.com/settings/tokens/new)
* 配置
* 開發者設置
* 個人訪問令牌 - `Tokens(classic)`
* 生成新令牌
* 選擇範圍:`repo``workflow`
* **保留** 您的秘密令牌(不要丟失,您稍後需要粘貼它)

<img src="https://github.com/Lin-jun-xiang/action-translate-readme/assets/63782903/b7487b49-817c-4925-b94a-bdb7b025a0c2" width=" 60%" />
* Create a new **`repository secret`**
* In your repository - `settings`

* 創建一個新的 **`repository secret`**
* 在您的倉庫 - `settings`
* `Securits and variables`
* `Actions`
* `New repository secret`
* Fill in the tag and name it (eg: `Action_Bot`) in `token`
* 填寫標籤為 `token` 並命名(例如:`Action_Bot`

<img src="https://github.com/Lin-jun-xiang/action-translate-readme/assets/63782903/27dc7bcd-633f-431e-98e8-387b97ecd47c" width=" 60%" />
3. Create the README language you want: `README.md`, `READM.zh-TW.md`,...

4. Create your action example in directory `.github/workflows/your_action.yml`.
4. 創建您想要的 **README** 語言:`README.md`, `READM.zh-TW.md`, ...

5. 在目錄 `.github/workflows/your_action.yml` 中創建您的 action 示例:

```
# .github/workflows/translate.yml
Expand All @@ -95,25 +66,23 @@ With the emergence of ChatGPT, the author thought that the translation task of t
fetch-depth: 3
- name: Auto Translate
uses: Lin-jun-xiang/action-translate-readme@v2 # Based on the tag
uses: Lin-jun-xiang/action-translate-readme@v2 # 根據標籤
with:
token: ${{ secrets.Action_Bot }} # Based on step2 name
g4f_provider: g4f.Provider.DeepAi # You can change this provider
token: ${{ secrets.Action_Bot }} # 根據步驟2名稱
g4f_provider: g4f.Provider.DeepAi # 您可以更改此提供者
```

5. Now you can update the `README.md`, and a translated version will be generated automatically!
6. 現在您可以更新 `README.md`,它將自動生成翻譯版本!

---

# Demo
# 演示

![](./img/auto-translation.gif)

---

# Results of Test Document

* View [test document](https://github.com/Lin-jun-xiang/vscode-extensions-best/tree/main)
* Update the test document using our tool
# 測試文檔結果

<a href="#top">Back to top</a>
* 查看 [測試文檔](https://github.com/Lin-jun-xiang/vscode-extensions-best/tree/main)
* 使用我們的工具更新測試文
2 changes: 2 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Hmm, I am not sure. Email [email protected] for more info.

0 comments on commit 89847e2

Please sign in to comment.