From aa8ddf1a09e1575bc3619e3efeb9c07dad275279 Mon Sep 17 00:00:00 2001 From: Gadfly Date: Fri, 25 Oct 2024 14:38:05 +0800 Subject: [PATCH 1/2] doc: Make the badges clickable and redirect to the TRANSLATION.md Signed-off-by: Gadfly --- .github/scripts/localization-check.js | 6 +++--- README.md | 2 +- TRANSLATION.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/scripts/localization-check.js b/.github/scripts/localization-check.js index 4841e3d6c..45db82bec 100644 --- a/.github/scripts/localization-check.js +++ b/.github/scripts/localization-check.js @@ -25,7 +25,7 @@ async function calculateTranslationRate() { const files = (await fs.readdir(localesDir)).filter(file => file !== 'en_US.axaml' && file.endsWith('.axaml')); // Add en_US badge first - badges.push(`![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)`); + badges.push(`[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md)`); for (const file of files) { const filePath = path.join(localesDir, file); @@ -41,12 +41,12 @@ async function calculateTranslationRate() { // Add badges const locale = file.replace('.axaml', '').replace('_', '__'); const badgeColor = translationRate === 100 ? 'brightgreen' : translationRate >= 75 ? 'yellow' : 'red'; - badges.push(`![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})`); + badges.push(`[![${locale}](https://img.shields.io/badge/${locale}-${translationRate.toFixed(2)}%25-${badgeColor})](TRANSLATION.md)`); } console.log(translationRates.join('\n\n')); - await fs.writeFile(outputFile, translationRates.join('\n\n'), 'utf8'); + await fs.writeFile(outputFile, translationRates.join('\n\n') + '\n', 'utf8'); // Update README.md let readmeContent = await fs.readFile(readmeFile, 'utf8'); diff --git a/README.md b/README.md index 34bdac1d5..95005a5cb 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ ## Translation Status -![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen) ![de__DE](https://img.shields.io/badge/de__DE-98.95%25-yellow) ![fr__FR](https://img.shields.io/badge/fr__FR-90.36%25-yellow) ![pt__BR](https://img.shields.io/badge/pt__BR-93.52%25-yellow) ![ru__RU](https://img.shields.io/badge/ru__RU-98.80%25-yellow) ![zh__CN](https://img.shields.io/badge/zh__CN-99.10%25-yellow) ![zh__TW](https://img.shields.io/badge/zh__TW-99.70%25-yellow) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.95%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-90.36%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-93.52%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.80%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.10%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.70%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 747293e53..aa9cc7af2 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -180,4 +180,4 @@ - Text.Preference.AI.AnalyzeDiffPrompt - Text.Preference.AI.GenerateSubjectPrompt - \ No newline at end of file + From 1c185fb7553befb7b03b6d01cd8254e4d5488039 Mon Sep 17 00:00:00 2001 From: Gadfly Date: Fri, 25 Oct 2024 14:47:30 +0800 Subject: [PATCH 2/2] ci: move localization check script file position Signed-off-by: Gadfly --- .github/workflows/localization-check.yml | 2 +- {.github => build}/scripts/localization-check.js | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {.github => build}/scripts/localization-check.js (100%) diff --git a/.github/workflows/localization-check.yml b/.github/workflows/localization-check.yml index d5ebe8c31..cc5201ab3 100644 --- a/.github/workflows/localization-check.yml +++ b/.github/workflows/localization-check.yml @@ -25,7 +25,7 @@ jobs: run: npm install fs-extra@11.2.0 path@0.12.7 xml2js@0.6.2 - name: Run localization check - run: node .github/scripts/localization-check.js + run: node build/scripts/localization-check.js - name: Commit changes run: | diff --git a/.github/scripts/localization-check.js b/build/scripts/localization-check.js similarity index 100% rename from .github/scripts/localization-check.js rename to build/scripts/localization-check.js