From 28773f0e2dfda8de85223f6ca3c33fcd6d6d0c58 Mon Sep 17 00:00:00 2001 From: GadflyFang Date: Fri, 25 Oct 2024 14:51:49 +0800 Subject: [PATCH] doc: Make the badges clickable and redirect to the TRANSLATION.md (#601) * Make the badges clickable and redirect to the TRANSLATION.md * Move localization check script file position --------- Signed-off-by: Gadfly --- .github/workflows/localization-check.yml | 2 +- README.md | 2 +- TRANSLATION.md | 2 +- {.github => build}/scripts/localization-check.js | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) rename {.github => build}/scripts/localization-check.js (89%) diff --git a/.github/workflows/localization-check.yml b/.github/workflows/localization-check.yml index d5ebe8c3..cc5201ab 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/README.md b/README.md index 34bdac1d..95005a5c 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 747293e5..aa9cc7af 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 + diff --git a/.github/scripts/localization-check.js b/build/scripts/localization-check.js similarity index 89% rename from .github/scripts/localization-check.js rename to build/scripts/localization-check.js index 4841e3d6..45db82be 100644 --- a/.github/scripts/localization-check.js +++ b/build/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');