-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Continuous Integration
committed
May 14, 2024
1 parent
8f2ca2a
commit ac59880
Showing
4 changed files
with
49 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1 @@ | ||
# action-translate-readme | ||
|
||
<p align="center"> | ||
<img src="img/2023-11-13-16-50-04.png" width="60%"/> | ||
</p> | ||
|
||
* [English](README.md) | ||
* [繁體中文版README.md](README.zh-TW.md) | ||
* [简体中文](README.zh-CN.md) | ||
* [Française](README.French.md) | ||
* [عربى](README.Arabic.md) | ||
|
||
|
||
# المقدمة | ||
|
||
> [!NOTE] | ||
> إن مترجم الإصدار `v1` تم تنفيذه باستخدام حزمة الطرف الثالث `Linux`؛ بينما يتم تنفيذ الإصدار `v2` باستخدام [`g4f`](https://github.com/xtekky/gpt4free) لاستدعاء واجهة برمجة تطبيقات openai مجانًا للترجمة. | ||
|
||
* نعلم جميعًا أن كتابة وثيقة README تستغرق وقتًا طويلاً ، ولكن الآن هناك حلاً يمكنك من خلاله توفير نصف الوقت. هذا هو `action-translate-readme` لدينا. | ||
|
||
* قم بترجمة إصدارات README المختلفة بواسطة `gpt3.5`. | ||
|
||
* تقديم **Github Actions(CI/CD) للترجمة التلقائية (commit، push)** للملفات المترجمة. | ||
|
||
* على سبيل المثال: **كتابة** أو **تعديل** إصدار README باللغة الإنجليزية ، ستتم إنشاء إصدارات README باللغة التايوانية التقليدية واللغة الصينية المبسطة واللغة الفرنسية وما إلى ذلك. | ||
|
||
|
||
# كيفية الاستخدام؟ | ||
|
||
|
||
> [!IMPORTANT] | ||
> نظرًا لأن `gpt3.5` هو نموذج AI القائم على الإنتاج ، فإنه يحتمل أن تكون هناك مشاكل في كل نتيجة للترجمة ، ويُنصح باستخدام الفروع للاختبار ومحاولة عدة مرات. | ||
> [!WARNING] | ||
> إذا واجهت الخطأ التالي: `Error: Input required and not supplied: token`، يُرجى التأكد من إنشاء `Token` وفقًا للخطوة الثانية ، أو التحقق مما إذا كان الـ `Token` قد انتهت صلاحيته! | ||
1. انقر على رمز النجمة :star: لإضافة هذا المشروع إلى مستودع Github الخاص بك. | ||
|
||
2. قم بتعيين `Github Token` الخاص بك: | ||
|
||
* [أنشئ **`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%" /> | ||
|
||
* أنشئ **`repository secret`** جديدًا | ||
* في مستودعك - `settings` | ||
* `Securits and variables` | ||
* `Actions` | ||
* `New repository secret` | ||
* قم بتعبئة علامة `token` وتسميتها (على سبيل المثال: `Action_Bot`) | ||
|
||
<img src="https://github.com/Lin-jun-xiang/action-translate-readme/assets/63782903/27dc7bcd-633f-431e-98e8-387b97ecd47c" width=" 60%" /> | ||
|
||
3. قم بإنشاء مثال الإجراء الخاص بك في الدليل `.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@v2 # Based on the tag | ||
with: | ||
token: ${{ secrets.Action_Bot }} # Based on step2 name | ||
g4f_provider: g4f.Provider.DeepAi # You can change this provider | ||
langs: "en,zh-TW,zh-CN,French,Arabic" # You can define any langs | ||
``` | ||
هناك ثلاثة معلمات تحتاج إلى إيلاء اهتمام خاص في الملف `.yml`: | ||
* `token`: الرمز الذي تم إنشاؤه في الخطوة 2 في المستودع | ||
* `g4f_provider`: مزود gpt ، يُرجى الرجوع إلى المزيد من التفاصيل في ال[رابط](https://github.com/xtekky/gpt4free/tree/main#gpt-35--gpt-4) | ||
* `langs`: الإصدارات التي تريد إنشاءها ، يجب عليك تحديد اللغات المختلفة بفاصلة `,` ، على سبيل المثال: | ||
* `"en"`: ترجمة الإصدار الإنجليزي فقط | ||
* `"en,zh-TW"`: ترجمة الإصدار الإنجليزي والإصدار التايواني التقليدي | ||
* `"French,Arabic"`: ترجمة الإصدار الفرنسي والإصدار العربي | ||
4. يمكنك الآن تحديث `README.md` وسيتم إنشاء إصدار مترجم تلقائيًا! | ||
--- | ||
# عرض توضيحي | ||
![](./img/auto-translation.gif) | ||
--- | ||
# نتائج وثيقة الاختبار | ||
* شاهد [وثيقة الاختبار](https://github.com/Lin-jun-xiang/vscode-extensions-best/tree/main) | ||
* استخدم أداةنا لتحديث وثيقة الاختبار | ||
<a href="#top">العودة إلى الأعلى</a> | ||
-------------------------------- | ||
当前地区当日额度已消耗完, 请尝试更换网络环境 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1 @@ | ||
# action-translate-readme | ||
|
||
<p align="center"> | ||
<img src="img/2023-11-13-16-50-04.png" width="60%"/> | ||
</p> | ||
|
||
* [English](README.md) | ||
* [Traditional Chinese Version README.md](README.zh-TW.md) | ||
* [Simplified Chinese](README.zh-CN.md) | ||
* [French](README.French.md) | ||
* [Arabic](README.Arabic.md) | ||
|
||
|
||
# Introduction | ||
|
||
> [!NOTE] | ||
> The translator of version `v1` is implemented through a third-party package on `Linux`; version `v2` is implemented by calling the OpenAI API for free through [`g4f`](https://github.com/xtekky/gpt4free). | ||
|
||
* We all know that writing README documentation takes a lot of time, 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 using `gpt3.5`. | ||
|
||
* Automatically commit (commit, push) the translated files through **Github Actions (CI/CD)**. | ||
|
||
* For example: **Write** or **modify** the English version of README, and automatically generate versions of README in Traditional Chinese, Simplified Chinese, French, etc. | ||
|
||
|
||
# How to use? | ||
|
||
|
||
> [!IMPORTANT] | ||
> Since `gpt3.5` is a generative AI model, there is a chance of problems with the translation 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 step two to ensure that the `Token` has been created or whether the `Token` has expired! | ||
1. Click on the :star: icon to add this project to your Github repository. | ||
|
||
2. Set up your `Github Token`: | ||
|
||
* [Create a new **`Github Secret Token`**](https://github.com/settings/tokens/new) | ||
* Setting | ||
* Developer settings | ||
* Personal access tokens - `Tokens (classic)` | ||
* Generate new token | ||
* Choose token **lifespan** - it is recommended to use **unlimited** | ||
* Choose scopes: `repo` and `workflow` | ||
* **Keep** your secret token (do not lose it, you will need to paste it later) | ||
|
||
<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` | ||
* `Securits and variables` | ||
* `Actions` | ||
* `New repository secret` | ||
* Fill in the label with `token` and name it (eg: `Action_Bot`) | ||
|
||
<img src="https://github.com/Lin-jun-xiang/action-translate-readme/assets/63782903/27dc7bcd-633f-431e-98e8-387b97ecd47c" width=" 60%" /> | ||
|
||
3. Create an example of your action 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 | ||
g4f_provider: g4f.Provider.DeepAi # You can change this provider | ||
langs: "en,zh-TW,zh-CN,French,Arabic" # You can define any langs | ||
``` | ||
There are three parameters in `.yml` that need special attention: | ||
* `token`: The token created in the repos based on step 2. | ||
* `g4f_provider`: The provider of gpt, for more information, please refer to the [link](https://github.com/xtekky/gpt4free/tree/main#gpt-35--gpt-4) | ||
* `langs`: The language versions you want to generate, be 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 | ||
4. Now you can update `README.md`, and it will automatically generate a translated version! | ||
--- | ||
# Demo | ||
![](./img/auto-translation.gif) | ||
--- | ||
# Results of Test Document | ||
* View the [test document](https://github.com/Lin-jun-xiang/vscode-extensions-best/tree/main) | ||
* Use our tool to update the test document | ||
<a href="#top">Back to top</a> | ||
当前地区当日额度已消耗完, 请尝试更换网络环境 |
Oops, something went wrong.